Module: Devise::QueryCustomizers::UserAuth

Defined in:
lib/generators/devise/customize/helpers/query_customizers.rb

Class Method Summary collapse

Class Method Details

.active_recordObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/generators/devise/customize/helpers/query_customizers.rb', line 21

def active_record
  %q{
  # protected

  def self.find_for_database_authentication(conditions)
    login = conditions.delete(:login)
    where(conditions).where(["username = :value OR email = :value", { :value => login }]).first
  end
}
end

.mongoidObject



32
33
34
35
36
37
38
39
# File 'lib/generators/devise/customize/helpers/query_customizers.rb', line 32

def mongoid
%q{
  def self.find_for_database_authentication(conditions)
    login = conditions.delete(:login)
    self.any_of({ :username => value }, { :email => login }).first
  end
}
end