Eric Lin
2008-Jan-23 00:38 UTC
acts_as_state_machine doesn''t error on invalid state transition?
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Jan-23 03:30 UTC
Re: acts_as_state_machine doesn''t error on invalid state transition?
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 Lin <eylinlist-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---