Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
the actual Users model, refs #87
Browse files Browse the repository at this point in the history
  • Loading branch information
obfuscurity committed May 12, 2013
1 parent deaa3c8 commit cf53924
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions lib/descartes/models/users.rb
@@ -0,0 +1,31 @@

class NilClass
def method_missing(name, *args, &block)
end
end

class Sequel::Model
end

class User < Sequel::Model

plugin :validation_helpers

def validate
super
validates_presence :email
end

def before_create
super
self.preferences = {:favorites => []}.to_json
self.token = SecureRandom.hex(32)
self.created_at = Time.now
self.updated_at = Time.now
end

def before_update
super
self.updated_at = Time.now
end
end

0 comments on commit cf53924

Please sign in to comment.