AASM dynamic state machine 2

AASM dynamic state machine 2

In my task manager project – the coductor.org –  I store the project type in the project model. The user can choose from simple todo or kanban project type. The project type defines the states of the tasks.

So when I choose simple todo, the state of my new task is todo. I can push the doit button and the state of the task becomes done. Here is the state definiton:

With kanban project type the initial state is todo and the states can be development, test, release and done. State definition:

I posted a not working solution in my previous blogpost because the states belongs to the class and not to the instance.

Here is the models/project.rb in my new and working solution:

lib/dsmmm.rb:

Here are the task buttons to change task.state in the task partial view:

You can try it live at my project’s site: http://theconductor.org

 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code