Skip to content

Instantly share code, notes, and snippets.

@knewter
Created January 14, 2011 21:37
Show Gist options
  • Save knewter/780296 to your computer and use it in GitHub Desktop.
Save knewter/780296 to your computer and use it in GitHub Desktop.
# Make a module that, when extended on an ActiveRecord class, will do the following:
# 1) Get the array Klass.state_machines.keys # => [:state]
# 2) states.each {|state| "def #{state}; blah; end; def #{state}=; blah; end" }
# NOTE: the code above should modify the getters and setters to actually look at the StateMachineState polymorphic table, write there and read there.
# 3) Take care of named scopes as well, because those will be broken.
# 4) Other, unknown yet still broken stuff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment