Skip to content

Instantly share code, notes, and snippets.

@zombor
Created June 4, 2010 03:02
Show Gist options
  • Save zombor/424874 to your computer and use it in GitHub Desktop.
Save zombor/424874 to your computer and use it in GitHub Desktop.
module Picombo
module Models
class User < Picombo::Model
storage_names[:default] = 'users'
property :id, Serial, :key => true
property :email, String
property :password, String
property :first_name, String
property :last_name, String
property :last_login, Integer
property :logins, Integer
property :activation_code, String
property :rating, Integer
property :funds, Float
property :has_bonus, Boolean
property :address, Text
has n, :roles, :through => Resource
has n, :tournaments, :through => Resource
has n, :wall_posts, :model => Picombo::Models::Wall_Post
has n, :ratings, :model => Picombo::Models::User_Rating, :order => [ :date.desc ]
def password=(new_password)
attribute_set(:password, Picombo::Auth.hash_password(new_password))
end
def self.name_field
:email
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment