mardi 3 novembre 2015

Handling multiple states in Rails

Currently, I try to figure out the best way how to handle states in my Rails app.

I have a model (Draws) which handles multiple states in three dimensions.

  • active / inactive
  • started / running / ended
  • not_full / full

There are five states I need to handle:

  • inactive & all other states
  • active & not_started & not_full
  • active & running & not_full
  • active & running & full
  • active & ended & full

Can somebody point me into the right direction regarding gems to use or articles to read to learn more about how to deal with states in Rails? Is it the correct way to combine the different attributes towards states? Do I have to define every transition separately?

Aucun commentaire:

Enregistrer un commentaire