# How to changing a AASM state using a Edit Action+Form View?

**URL:** <https://www.ruby-forum.com/t/how-to-changing-a-aasm-state-using-a-edit-action-form-view/178245>\
**Category:** Rails\
**Created:** [October 31, 2009, 8:48pm UTC](https://www.ruby-forum.com/t/how-to-changing-a-aasm-state-using-a-edit-action-form-view/178245 "2009-10-31T20:48:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [October 31, 2009, 8:48pm UTC](https://www.ruby-forum.com/t/how-to-changing-a-aasm-state-using-a-edit-action-form-view/178245/1 "2009-10-31T20:48:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![davidstokar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/4da419/32.png) [@davidstokar](https://www.ruby-forum.com/u/davidstokar)\
**Post date:** [November 1, 2009, 4:43pm UTC](https://www.ruby-forum.com/t/how-to-changing-a-aasm-state-using-a-edit-action-form-view/178245/2 "2009-11-01T16:43:35Z")

</div>

On Oct 31, 2:48 pm, David S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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.
