Skip to content

Instantly share code, notes, and snippets.

@TheNicholasNick
Created March 10, 2009 01:13
Show Gist options
  • Save TheNicholasNick/76599 to your computer and use it in GitHub Desktop.
Save TheNicholasNick/76599 to your computer and use it in GitHub Desktop.
class User < CouchRest::ExtendedDocument
use_database CouchRest.database!(Merb::Config[:couchdb_url] + Merb::Config[:database])
property :email
property :crypted_password
property :salt
save_callback :before, :encrypt_password
timestamps!
unique_id :set_id
couchrest_type = "user"
def authenticate(email, password)
#@u = first(Merb::Authentication::Strategies::Basic::Base.login_param => email)
#@u && @u.authenticated?(password) ? @u : nil
end
private
def set_id
"user_#{self['email']}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment