geekq / workflow

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

Support for enumerated state values #158

Closed theSteveMitchell closed 5 years ago

theSteveMitchell commented 9 years ago

We can now store an integer in the database/store to persist state, rather than a string benefits to this:

  1. Storing raw strings for state columns is generally not best practice. Now we don't have to think about it.
  2. We don't want the length of a state's name to be limited based on a db column size (rather it should be limited by developer sensibility)
  3. We would like to change the name of a state at any time to make it more expressive, without needing to fixup/migrate underlying data.

This is somewhat hacky, so suggestions are welcome. But tests are good, and scopes are fully supported.

theSteveMitchell commented 9 years ago

btw I think I found an existing issue where negative scopes weren't working in rails 3.x

theSteveMitchell commented 9 years ago

@geekq

theSteveMitchell commented 9 years ago

@geekq ping!