Class: Party

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/party.rb

Direct Known Subclasses

Group, User

Instance Method Summary collapse

Instance Method Details

#controllerObject



8
9
10
# File 'app/models/party.rb', line 8

def controller
  self.class.name.downcase.pluralize
end

#current_speedObject



16
17
18
19
20
21
22
23
24
25
# File 'app/models/party.rb', line 16

def current_speed
  completed_periods = periods.select {|p| p.end_on < Date.today}
  if last_completed = completed_periods.last
    last_completed.speed
  elsif active_period = periods.to_ary.find {|p| p.active?}
    active_period.speed
  else
    0
  end
end

#iconObject



12
13
14
# File 'app/models/party.rb', line 12

def icon
  to_sym.to_s + '.png'
end

#to_symObject



4
5
6
# File 'app/models/party.rb', line 4

def to_sym
  self.class.name.downcase.to_sym
end