Class: Did::Action::Sit
- Inherits:
-
Object
- Object
- Did::Action::Sit
- Defined in:
- lib/did/action/sit.rb
Instance Attribute Summary collapse
-
#start_time ⇒ Object
Returns the value of attribute start_time.
Instance Method Summary collapse
Instance Attribute Details
#start_time ⇒ Object
Returns the value of attribute start_time.
6 7 8 |
# File 'lib/did/action/sit.rb', line 6 def start_time @start_time end |
Instance Method Details
#perform ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/did/action/sit.rb', line 8 def perform current_sitting = Sitting.find(:first, :conditions => {:current => true}) if current_sitting && current_sitting.end_time.nil? current_sitting.update_attributes(:start_time => @start_time) else current_sitting.update_attributes(:current => false) if current_sitting Sitting.create(:start_time => @start_time, :current => true) end end |