#16 new
Cassiano D'Andrea

Previous (or current) and new states the same when calling aasm_event_fired()

Reported by Cassiano D'Andrea | March 23rd, 2009 @ 01:59 PM

When calling the :aasm_event_fired method (when defined), automatically fired by AASM::aasm_fire_event, the previous (or current) and new states seem to always be the same, due to the fact that the call to AASM::set_aasm_current_state_with_persistence changes the value of the :aasm_current_state attribute to the new state prior to the :aasm_event_fired call. Follows a possible (and simple) solution:


Also, I would like to suggest that the 'persist' parameter be passed along to :aasm_event_fired call, so logging the status change in a separate model might be possible in this method (which wouldn't make sense if persist == false). So the final code might look like:




Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Library for adding state machines to Ruby classes. Includes persistence layers for things like ActiveRecord. Formerly known as acts_as_state_machine.

People watching this ticket