I've just started using state_machine gem and it has already cleaned
up a lot of my code. I do however need to do 1 specific thing and
can't figure out from the README if/how this can be done.
All the code will be used in a Rails 3 app.
Let's say I have an article model which looks something like this:
state_machine :state, :initial => :new do
event :submit_for_approval do
transition [:new, :declined] => :pending
event :decline do
transition [:pending] => :declined
event :approve do
transition [:pending, :declined] => :published
This will give me the following methods (among others):
submit_for_approval, approve and decline.
Let's say I would like to keep a log of whoever performed these
actions on the given article.
I know there is something called state_machine-audit_trail, however
this only logs the changes.
I would like to pass in the invoker of the change in the
submit_for_approval, approve and decline methods. How can I achieve
If this is not possible or considered a bad practice what would you