aasm/aasm — pull request #90 by Intrepidd (2013-09-03 11:19:56+00:00)
Title: Allow a block to be called when running a transition

Hi,

This is based on the former ``run_transition`` method of the old acts_as_state_machine gem from @rubyist

Sometimes, you want to do an action only if the transition succeeds, but you also want to call the failed callbacks when it does not.

I did not find any way to do this natively (feel free to point out some existing ways if there are), so I implemented this little feature.

````ruby
object.transition! do
some_code
end
````

``some_code`` will be called only if the transition succeeds, before launching the after_enter callbacks.