Hello there,
I’m using AASM to manage states in my User model.
I want to change the status through the edit action.
To do this I’m using the method User.aasm_states_for_select in my form
to populate the select input for states.
When I hit the button commit all the changes are saved, including the
state name. But the AASM event for that state is not called, it is
happening because only the field status has changed and the event method
has not been called.
Does anyone have a solution form my problem?
Thanks,
David S.
On Oct 31, 2:48 pm, David S. [email protected]
wrote:
has not been called.
Does anyone have a solution form my problem?
You’ll probably want to look at the source for aasm_fire_event; that
handles the firing of the :enter and :exit callbacks.
However, you may also want to be sure that the dropdown is what you
want - the whole point of having a state machine abstraction is to
avoid just arbitrarily changing stuff to other states. Thus, you’d
typically want an ‘approve’ button/link that calls a state transition
(for instance) rather than just editing a user’s record and manually
picking ‘approved’ from a status dropdown.
–Matt J.