Terpinator wrote: > I have one method, 'updateStuff', that will call 'update_attributes' > on 3 different models in the DB..... > > How can I account for validation to revert back all updates if one of > the models is not valid?
Note that you want all-or-nothing DB updates, but, for purposes of form redisplay, always want both in-memory attribute updates and validity-checking done on each. Here's how: 1. Update attributes on each without saving using the attributes= method. 2. Call valid? on each, storing each result in a local variable. 3. Proceed with transaction-wrapped saves if all three variables are true. -- 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 -~----------~----~----~----~------~----~------~--~---

