Michael Kahle wrote: > Ok. I'm confused. If I step through my code line by line it would seem > to me that it does the following: > > 1.) Creates a new object to dump stuff into. > 2.) Dumps everything from the form (params) into these new objects. > 3.) Begins the transaction. > 4.) First updates @snowplow_registration, the ! at the end of the update > method forces a check against the model for validation and returns any > errors that come from the update. If it doesn't succeed, then it is > caught by the rescue case and then checks the @customer object for > errors.
The "!" just causes an exception to be raised if the record is invalid, or if saving was prevented by a callback. Here you've already checked that both the records are valid, so you just want to ensure that any other problem causes the propagation of an app-wide exception (which will also rollback the transaction). Also, you have already updated the records from the user-form using attributes=. Therefore you want to use save_without_validation! rather than update_attributes!, save!, or save. -- 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 rubyonrails-talk@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---