Skip to content

Instantly share code, notes, and snippets.

@danhigham
Created June 22, 2011 08:47
Show Gist options
  • Save danhigham/1039716 to your computer and use it in GitHub Desktop.
Save danhigham/1039716 to your computer and use it in GitHub Desktop.
class User
# attr :password
include DataMapper::Resource
property :id, Serial
property :name, String
property :email, String
property :password, String
property :account_provider, Integer
# def password
# @password
# end
def password=(val)
@password = Digest::SHA1.hexdigest(val)
end
def self.authenticate(email, password)
User.first(:email => email, :password => password)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment