Skip to content

Instantly share code, notes, and snippets.

@ropiku
Created February 11, 2009 23:33
Show Gist options
  • Save ropiku/62368 to your computer and use it in GitHub Desktop.
Save ropiku/62368 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment