pluginaweek/state_machine

Support for Rail 4.1.0(-beta) AR enums

Opened this issue · 1 comments

Does anyone know if state_machine plays well with the new ActiveRecord enum feature? I was considering upgrading my app sooner than I normally would for it, but I'd want to use it in conjunction with state_machine.

I don't see any reason why it couldn't be made work, since state_machine accepts integer state, but my concerns are:

  • Loss of 'pretty' references to states as symbols+strings when using the raw integer mapping
  • Overlapping getter/setter concerns such as state=, state, in_state?, set_state!, etc.

It seems like an alternative StateMachine::Integrations::ActiveRecordEnum could be made to handle this case, and offload a lot of functionality onto it. I don't know. I might poke around the Integration later to see what this would entail, but I thought I'd see if there was any other pioneering work on Enum support.

I used aasm because it works with AR enum.
However, I like state_machine API more so it'd be nice to have this feature.

Is this feature in the roadmap?