# Acts\_as\_state\_machine doesn't error on invalid state transition?

**URL:** <https://www.ruby-forum.com/t/acts-as-state-machine-doesnt-error-on-invalid-state-transition/126880>\
**Category:** Rails\
**Created:** [January 23, 2008, 1:39am UTC](https://www.ruby-forum.com/t/acts-as-state-machine-doesnt-error-on-invalid-state-transition/126880 "2008-01-23T01:39:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eric99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a88e4f/32.png) [@eric99](https://www.ruby-forum.com/u/eric99)\
**Post date:** [January 23, 2008, 1:39am UTC](https://www.ruby-forum.com/t/acts-as-state-machine-doesnt-error-on-invalid-state-transition/126880/1 "2008-01-23T01:39:55Z")

</div>

While using acts\_as\_state\_machine, I noticed it doesn’t error when  
invalid  
state transition is used. No false return, no exception. By invalid  
state  
transition, I mean utilizing an event that does not define the current  
state  
as a ‘from’ state. Does anyone find this lacking? I would like to be  
able  
to catch invalid state transition (such as attempting to fulfill a  
closed  
order) and report that to the user.  
Thanks

---

<div class="post-metadata">

**Author:** ![eric99](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/a88e4f/32.png) [@eric99](https://www.ruby-forum.com/u/eric99)\
**Post date:** [January 23, 2008, 4:31am UTC](https://www.ruby-forum.com/t/acts-as-state-machine-doesnt-error-on-invalid-state-transition/126880/2 "2008-01-23T04:31:47Z")

</div>

I’m using acts\_as\_state\_machine and when I transfer to an invalid state  
it  
gives back [] instead of true (which would be returned if it was a valid  
state). I think this should be returned as false. I looked through the  
code  
and I couldn’t see where it’s returning []. If you can find this you  
could  
change the code to return false instead.

On Jan 23, 2008 11:08 AM, Eric L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> While using acts\_as\_state\_machine, I noticed it doesn’t error when invalid  
> state transition is used. No false return, no exception. By invalid state  
> transition, I mean utilizing an event that does not define the current state  
> as a ‘from’ state. Does anyone find this lacking? I would like to be able  
> to catch invalid state transition (such as attempting to fulfill a closed  
> order) and report that to the user.  
> Thanks
> 
> >

–  
Ryan B.

> **[frozenplague.net](http://www.frozenplague.net)**
>
> This domain may be for sale!

Feel free to add me to MSN and/or GTalk as this email.
