Using acts_as_state_machine transition methods without saving

440 Views Asked by At

I want to be able to utilize the acts_as_state_machine transition methods which are auto-generated (e.g. event!).. but I don't want it to save right away. I'm updating the state as part of another set of operations, and so I don't want to be doing double saves.

Is there any way to trigger these event methods without a save right afterward?

1

There are 1 best solutions below

1
On

By looking at acts_as_state_machine's code (line 65) I found that it is defining event-methods without a bang too. This will update the state internally in the object without storing it to the database. Hope that helps :-)