You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then, from console (or in your controller) run the following commands:
Wheel.create!(car: Car.new)w=Wheel.firstw.update_attributes(car_attributes: {state_event: :drive})w=Wheel.first#reload that same wheelw.update_attributes(car_attributes: {state_event: :stop})
That last command should cause the car to go from driving to parked, but instead the transaction is rolled back with the error :"car.state_event"=>["cannot transition when parked"]. If you check the car state without reloading the model, it says parked, but after reload it goes back to driving.
So it seems that something is setting the car state to parked as expected, but then a rollback occurs because the drive event cannot transition from a parked state. (Like it's trying to transition twice and then rolls it all back when the 2nd one fails.)
The text was updated successfully, but these errors were encountered:
smudge
changed the title
Assigning 'state_event' through nested attributes fails with rollback.
Assigning 'state_event' through nested attributes fails.
Oct 27, 2014
It seems that this project is mostly dead/stalled at this point, but I'm filing this issue for posterity's sake.
The bug is around the ability to fire off an event by assigninment, as follows:
Here's the repro setup (using a totally new rails 3.2.19 app):
Then, from console (or in your controller) run the following commands:
That last command should cause the car to go from driving to parked, but instead the transaction is rolled back with the error
:"car.state_event"=>["cannot transition when parked"]
. If you check the car state without reloading the model, it saysparked
, but after reload it goes back todriving
.So it seems that something is setting the car state to
parked
as expected, but then a rollback occurs because thedrive
event cannot transition from aparked
state. (Like it's trying to transition twice and then rolls it all back when the 2nd one fails.)The text was updated successfully, but these errors were encountered: