geekq / workflow

Ruby finite-state-machine-inspired API for modeling workflow
MIT License
1.74k stars 207 forks source link

Rails 5 Support Potential Solutions #205

Closed blimmer closed 5 years ago

blimmer commented 6 years ago

I'm opening this issue in an attempt to brainstorm some options for people who are looking to upgrade to Rails 5 and use this gem.

Rewrite Persistence

The readme recommends this:

https://github.com/geekq/workflow#custom-workflow-state-persistence

Fork with Rails 5 Patches

The @spreemo patch seems to have a few patches for the use cases they ran into:

https://github.com/geekq/workflow/compare/master...spreemo:master

More Major Rewrite

This seems to have yet more integration with ActiveRecord:

https://tylergannon.github.io/rails-workflow

It might be scarier to move into this gem because of the larger rewrite

More?

If anyone else has successfully upgraded to Rails 5 with this gem, please feel free to add comments here. Perhaps we can gather the list of problems and come up with a solution that can be merged into this main project (see also #177 )

kingdonb commented 6 years ago

I am mulling over a Rails 5 upgrade and we use the workflow gem with Rails 4. I did not realize it might be a problem to upgrade to Rails 5 because of this gem, which appears to be (at least relatively?) unmaintained

I will let you know how it goes. It's interesting that this project hasn't had a release since 2014, but there are apparently features in the master branch such as the particular implementation of https://github.com/geekq/workflow#conditional-event-transitions described in the README (you cannot use a method symbol name as described in #183 but this apparently is supported in master, based on some work that was merged since v1.2.0)

Is there anyone still merging PRs on this gem? Need for volunteers?

duffyjp commented 6 years ago

I'm still using stock workflow with a large Rails 5.0.6 project. I'm not doing anything terribly fancy, but it's still working fine for me. I guess I don't run into the specific cases causing problems. My git log shows we added Workflow in January 2012. Would have been Rails 3.x back then.

Another app I converted over to AASM. I like the way states & events are setup in workflow a lot better though.

yebyen commented 6 years ago

I've spoken with other people (this past week at RailsConf 2018) who are of the opinion that "geekq/workflow is not abandoned it's just finished" as in, doesn't have any bugs left in it

I don't know if that's true, but I've never used AASM and nobody who knows anything seems to be suggesting to move away from this gem

svoop commented 6 years ago

I've switched to gem 'workflow', github: 'caseyprovost/workflow', branch: 'chores/rails-5.0' for now which works fine.

"(...) it's just finished" as in, doesn't have any bugs left in it

I don't quite agree. Most people use workflow in the context of Rails and as of current Master, geekq/workflow is broken on Rails 5 and up. The corresponding note in the README is no fix, just a mere hint at how factoring out the persistence code would be a fix.

I'm still having hope though that either @geekq can implement this and/or passes the gem (I mean the authoritative release from rubygems.org) to someone else who will. Otherwise, I'll have to switch to AASM despite the headache this may cause.

geekq commented 6 years ago

it's just finished" as in, doesn't have any bugs left in it

The core of workflow (implementation for state transitions DSL) is stable and has worked for years, as it is now. There is also a stable interface to implement persistence, e.g. for ActiveRecord in Rails or others.

Since Rails internal interfaces / implementation change frequently, the integration with Rails is hard to implement in a non fragile way. Also a huge if ACTIVE_RECORD_VERSION == '3' elsif ACTIVE_RECORD_VERSION == '4' ACTIVE_RECORD_VERSION == '5' ACTIVE_RECORD_VERSION == '5.1' is hard to maintain / to back up with continuous integration.

Since I am not using Rails 5.x, I have not implemented any integration with it.

Since I do not know, how well the different workflow forks for Rails 5 support Rails 4.x, 3.x and 2.x I can not recommend any. Thanks to all people providing links/references (see comments above) to forks supporting Rails 5.x!

What I failed to do so far is:

... will do. Disclaimer: on a best effort basis ;-)

dennyluan commented 5 years ago

Any updates on the branch that was proposed re: tests for Rails 5 support?

Thanks for supporting the improvements of this gem!

Just wanted to report that I'm currently also using this in Rails 5.0.7 after upgrading from 4.2. So far, things seem to be working fine.

svoop commented 5 years ago

For those looking for alternatives other than AASM, the finite_machine gem has just awakened from a two years hibernation.

geekq commented 5 years ago

Yeah! workflow awakened from hibernation too!

Workflow 2.0 released!

Please try it out with your application! If it is a Rails application, please use https://rubygems.org/gems/workflow-activerecord/versions/4.1.2 Instructions, how to use, are at https://github.com/geekq/workflow-activerecord#workflow-activerecord

Please report any bugs as a new issue for the relevant of both libraries:

Note for contributors: looks like github closed all the pull requests after I had changed the default branch on 2019-01-12. Please check the new refactored workflow 2.0, complementing workflow-activerecord and recreate your pull request if needed.