mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-25 08:34:08 +01:00
update gems and fix failures from new aasm
I'm not sure the test failures caused by reload not working are caused by the new aasm, perhaps the thread isolation is causing that...
This commit is contained in:
parent
93b0a2557c
commit
5ed69fc1a2
7 changed files with 91 additions and 85 deletions
|
|
@ -13,18 +13,17 @@ class RecurringTodo < ActiveRecord::Base
|
|||
include IsTaggable
|
||||
|
||||
include AASM
|
||||
aasm_column :state
|
||||
aasm_initial_state :active
|
||||
aasm :column => :state do
|
||||
state :active, :initial => true, :before_enter => Proc.new { |t| t.occurences_count = 0 }
|
||||
state :completed, :before_enter => Proc.new { |t| t.completed_at = Time.zone.now }, :before_exit => Proc.new { |t| t.completed_at = nil }
|
||||
|
||||
aasm_state :active, :enter => Proc.new { |t| t.occurences_count = 0 }
|
||||
aasm_state :completed, :enter => Proc.new { |t| t.completed_at = Time.zone.now }, :exit => Proc.new { |t| t.completed_at = nil }
|
||||
event :complete do
|
||||
transitions :to => :completed, :from => [:active]
|
||||
end
|
||||
|
||||
aasm_event :complete do
|
||||
transitions :to => :completed, :from => [:active]
|
||||
end
|
||||
|
||||
aasm_event :activate do
|
||||
transitions :to => :active, :from => [:completed]
|
||||
event :activate do
|
||||
transitions :to => :active, :from => [:completed]
|
||||
end
|
||||
end
|
||||
|
||||
validates_presence_of :description
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue