Michael Kahle wrote: > Mark Reginald James wrote: >> Michael Kahle wrote: >> >> >>> Super! Thanks so much. It worked perfectly. The only thing I changed >>> from your example was to handle the update as a transaction. Updating >>> @registration and @customer with the ".attributes" method did the trick >>> perfectly. I am off to experiment with the "validates_associated >>> :customer". >> >> Could you explain a little more what you changed and why.
Ooo. Another thought. I noticed that you are doing a transaction without using the "rescue" catch. If something else goes wrong, besides validation, you will never know what happened! :) > if @snowplow_registration.valid? && customer_valid > SnowplowRegistration.transaction do > @snowplow_registration.save! > @customer.save! > flash[:notice] = 'Snow Plow Registration was updated.' > redirect_to(@snowplow_registration) > end > else > render :action => :edit > end So in that case, I prefer a sprinkle of your code with mine. Well, to be honest I probably lifted this off of one of the pages in my Agile Web Development with Rails book. So I won't take any credit for this. I wish I could! Cheers. -- Posted via http://www.ruby-forum.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 -~----------~----~----~----~------~----~------~--~---