module MinimalistAuthentication::User::ClassMethods

Public Instance Methods

find_enabled(id) click to toggle source

Finds a user by their id and returns the user if they are enabled. Returns nil if the user is not found or not enabled.

# File lib/minimalist_authentication/user.rb, line 40
def find_enabled(id)
  find_by(id:)&.enabled if id.present?
end
guest() click to toggle source

Returns a frozen user with the email set to GUEST_USER_EMAIL.

# File lib/minimalist_authentication/user.rb, line 52
def guest
  new(email: GUEST_USER_EMAIL).freeze
end
inactive() click to toggle source
# File lib/minimalist_authentication/user.rb, line 44
      def inactive
        MinimalistAuthentication.deprecator.warn(<<-MSG.squish)
          Calling #inactive is deprecated. Use #active(false) instead.
        MSG
        active(false)
      end