Skip to content

Instantly share code, notes, and snippets.

@ajsharp
Created August 23, 2009 02:02
Show Gist options
  • Save ajsharp/173090 to your computer and use it in GitHub Desktop.
Save ajsharp/173090 to your computer and use it in GitHub Desktop.
include AASM
include AASM::Persistence
aasm_column :status
aasm_initial_state Proc.new { |task| task.assignments.empty? ? :not_started }
aasm_state :not_started
aasm_state :in_progress
aasm_state :completed
aasm_event :start_task do
transitions :to => :in_progress, :from => :not_started
end
aasm_event :complete_task do
transitions :to => :completed, :from => :in_progress
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment