Class: TentD::Model::User

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/tentd/model/user.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.currentObject



29
30
31
# File 'lib/tentd/model/user.rb', line 29

def self.current
  Thread.current[:user]
end

.current=(u) ⇒ Object



22
23
24
25
26
27
# File 'lib/tentd/model/user.rb', line 22

def self.current=(u)
  relationships.each do |relationship|
    relationship.child_model.default_scope(:default).update(:user => u)
  end
  Thread.current[:user] = u
end

Instance Method Details

#profile_entityObject



33
34
35
36
# File 'lib/tentd/model/user.rb', line 33

def profile_entity
  info = profile_infos.first(:type_base => ProfileInfo::TENT_PROFILE_TYPE.base, :order => :type_version.desc)
  info.content['entity'] if info
end