Created
June 27, 2012 18:35
-
-
Save nguyenlocduy/3005919 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AdminUser < ActiveRecord::Base | |
# Include default devise modules. Others available are: | |
# :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable | |
devise :database_authenticatable, | |
:recoverable, :rememberable, :trackable, :validatable | |
# Setup accessible (or protected) attributes for your model | |
attr_accessible :email, :login, :password, :password_confirmation, :remember_me | |
attr_accessor :login | |
protected | |
def self.find_for_database_authentication(warden_conditions) | |
conditions = warden_conditions.dup | |
login = conditions.delete(:login) | |
where(conditions).where(["lower(email) = :value", { :value => login.strip.downcase }]).first | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment