state-machines / state_machines

Adds support for creating state machines for attributes on any Ruby class
https://github.com/state-machines/state_machines
MIT License
814 stars 91 forks source link

upgrade path from state_machine? #14

Closed jjb closed 9 years ago

jjb commented 9 years ago

Hi,

Thanks for this great project. I didn't know about it until a couple days ago.

I think many of your users will be transitioning here from the state_machine gem. Do you think you could add a couple lines to the readme explaining what the upgrade path is? Is it a seamless transition?

If you answer in this issue then I'll be happy to submit a PR.

Thanks!

seuros commented 9 years ago

The module name changed from StateMachine to StateMachines And the integrations are in separate gems. Dropped support for old Rubies/AR/Mongo/ect.

seuros commented 9 years ago

And the tests are green :green_heart:

agis commented 9 years ago

Hello @seuros!

Unfortunately, in a Rails 3.2 app (ruby 2.1.5) where I was using state_machine (latest version), I switched to state_machines (latest version) and I get test failures. Apparently something has changed and state_machines is not 100% backwards-compatible with state_machine.

I'm currently investigating what might be causing these failures but if you had any insight on this, it would be very helpful. Thanks!

seuros commented 9 years ago

Do you still use rails 3.2 ? The integrations are in separate gems.

agis commented 9 years ago

Yes, I'm on 3.2 and in the process of upgrading to 4.x. I've also added the integration gems:

but the same failures are present even when using these gems.

seuros commented 9 years ago

state_machines-activerecord will require all the other gems.
What type of failure do you have ? Can you provide a sample apple that replicate the error ?

agis commented 9 years ago

I've removed state_machine 1.1.2 and replaced it with state_machines-activerecord 0.0.0 (the only version that does not depend on rails 4.x) and I get a new failure:

/Users/agis/.gem/ruby/2.1.5/gems/activerecord-3.2.22/lib/active_record/dynamic_matchers.rb:55:in `method_missing': undefined method `state_ma
chine' for #<Class:0x007fa3bb40dc68> (NoMethodError)
        from /Users/agis/dev/foo/myapp/lib/rqueue.rb:54:in `method_missing'
        from /Users/agis/dev/foo/myapp/app/models/sku_review.rb:122:in `<class:SkuReview>'
        from /Users/agis/dev/foo/myapp/app/models/sku_review.rb:2:in `<top (required)>'
        from /Users/agis/.gem/ruby/2.1.5/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
        from /Users/agis/.gem/ruby/2.1.5/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `block in require'
        from /Users/agis/.gem/ruby/2.1.5/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:236:in `load_dependency'
        from /Users/agis/.gem/ruby/2.1.5/gems/activesupport-3.2.22/lib/active_support/dependencies.rb:251:in `require'
seuros commented 9 years ago

Ah. I should yank that version, sorry for the confusion. state_machines-activerecord support from 4.1+. my fork of the legacy gem support until 4.0.

agis commented 9 years ago

So for Rails 3.2 should we use your fork (seuros/state_machine)?

seuros commented 9 years ago

You can . But new features are added to this org only.