Skip to content

Instantly share code, notes, and snippets.

@Porta
Created January 24, 2012 17:38
Show Gist options
  • Save Porta/1671403 to your computer and use it in GitHub Desktop.
Save Porta/1671403 to your computer and use it in GitHub Desktop.
states
state_machine :status, :initial => :new do
event :accept do
transition :new => :accepted
end
event :reject do
transition :new => :rejected
end
event :done do
transition :accepted => :done
end
event :close do
transition [:new, :accepted, :rejected, :done] => :closed
end
event :hide do
transition [:rejected, :done] => :hidden
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment