Skip to content

Instantly share code, notes, and snippets.

@tekwiz
Created April 26, 2010 06:12
Show Gist options
  • Save tekwiz/379033 to your computer and use it in GitHub Desktop.
Save tekwiz/379033 to your computer and use it in GitHub Desktop.
state_machine User do
state :new
state :normal
state :locked
end
state_machine Membership do
state :new
state :active
state :inactive
end
state_machine Account, User do
# interesting idea... thoughts on this?
end
class User
state_machine do
state :new
state :normal
state :locked
end
end
@hosh
Copy link

hosh commented Apr 27, 2010

This circles around the same problem domain and comes up with a different solution from a different approach: http://www.infoq.com/news/2009/11/restfulie-hypermedia-services

The states are kept in the model, but now we're linking it to the controller and adding some actions via hyperlinking into the resources directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment