When a method being called in the success or enter phases of a state transition throw errors, what is the best way to catch this and ensure that the state reverts back to the previous state.
I’m using the AASM gem.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What about using the :guard option to make sure the transition can be performed? If the guard method returns false, the transition isn’t executed at all. So, I’d check if every condition of the transition is met with the guard method, first.