module Devise::Models::DatabaseAuthenticatable::ClassMethods
def authenticate(attributes={})
Authenticate a user based on configured attribute keys. Returns the
def authenticate(attributes={}) return unless authentication_keys.all? { |k| attributes[k].present? } conditions = attributes.slice(*authentication_keys) resource = find_for_authentication(conditions) resource if resource.try(:valid_for_authentication?, attributes) end
def encryptor_class
def encryptor_class @encryptor_class ||= ::Devise::Encryptors.const_get(encryptor.to_s.classify) end
def find_for_authentication(conditions)
end
find(:first, :conditions => conditions)
conditions[:active] = true
def self.find_for_authentication(conditions={})
Example:
namedscope to filter records while authenticating.
Overwrite to add customized conditions, create a join, or maybe use a
Find first record based on conditions given (ie by the sign in form).
def find_for_authentication(conditions) find(:first, :conditions => conditions) end