2010-04-09 09:23:41 +00:00
|
|
|
class Account
|
2010-04-13 13:24:12 +00:00
|
|
|
include Mongoid::Document
|
|
|
|
include Mongoid::Timestamps
|
2010-04-09 09:23:41 +00:00
|
|
|
|
2010-04-13 13:24:12 +00:00
|
|
|
# devise modules
|
2010-04-13 14:26:40 +00:00
|
|
|
devise :database_authenticatable, :recoverable, :rememberable, :trackable, :validatable #:registerable,
|
2010-04-13 13:24:12 +00:00
|
|
|
|
|
|
|
# attr_accessible :email, :password, :password_confirmation # TODO
|
2010-04-09 09:23:41 +00:00
|
|
|
|
2010-04-13 13:24:12 +00:00
|
|
|
## attributes ##
|
|
|
|
field :name
|
|
|
|
field :locale, :default => 'en'
|
|
|
|
|
|
|
|
## validations ##
|
|
|
|
validates_presence_of :name
|
|
|
|
|
|
|
|
## associations ##
|
|
|
|
|
|
|
|
def sites
|
|
|
|
Site.where({ :account_ids => self._id })
|
|
|
|
end
|
2010-04-09 09:23:41 +00:00
|
|
|
|
|
|
|
end
|