Class: SlUser

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/models/sl_user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object (protected)



56
57
58
# File 'lib/models/sl_user.rb', line 56

def method_missing(m, *args)
  return false
end

Instance Attribute Details

#passwordObject

Returns the value of attribute password.



23
24
25
# File 'lib/models/sl_user.rb', line 23

def password
  @password
end

#password_confirmationObject

Returns the value of attribute password_confirmation.



23
24
25
# File 'lib/models/sl_user.rb', line 23

def password_confirmation
  @password_confirmation
end

Instance Method Details

#admin?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/models/sl_user.rb', line 38

def admin?
  self.permission_level == -1 || self.id == 1
end

#displayed_oohsObject



46
47
48
49
50
51
52
# File 'lib/models/sl_user.rb', line 46

def displayed_oohs
  oohs = []
  oohs += self.oohs.all(:recipient_id => nil, :limit => 10, :order => [:created_at.desc]) # don't show direct messsages
  self.follows.each do |follows| oohs += follows.oohs.all(:recipient_id => nil, :limit => 10, :order => [:created_at.desc]) end if @myself == @user
  oohs.sort! { |x,y| y.created_at <=> x.created_at }
  oohs[0..10]    
end

#site_admin?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/models/sl_user.rb', line 42

def site_admin?
  self.id == 1
end