Created
July 10, 2009 14:18
-
-
Save antunderwood/144549 to your computer and use it in GitHub Desktop.
This file contains 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 User < ActiveRecord::Base | |
include Roleify::RoleifyableModel | |
include Clearance::User | |
attr_accessible :username | |
validates_presence_of :username | |
validates_uniqueness_of :username | |
def self.authenticate(email, password) | |
user = find(:first, :conditions => ['username = ? OR email = ?', email.to_s.downcase, email.to_s.downcase]) | |
user && user.authenticated?(password) ? user : nil | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment