Farrel wrote: > I'm on Rails 2.2.2 on MySQL with InnoDB table types. I'm running into > a wierd bug where if I have two models in a transaction and the second > model raises an exception, the first model still has it's ID set and > it's new_record status set to false despite the row the ID is set to > never existing.
Yes, that's the way Transactions (now) work. The correct way to handle this is to not proceed with a transaction unless all model instances being saved in that transaction have been validated. The alternative is to wrap rollback_active_record_state! blocks around the transaction for all instances being saved except the last. -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com --~--~---------~--~----~------------~-------~--~----~ 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

