Hello, I''ve been digging into the discussion around nested mass assignment, and am trying my hand at a plugin that adds what I consider the optimal model behavior. But I''m running into a solid problem trying to use association proxies without modifying anything in the database. My take is that there should be three very discrete phases to updating: assignment, validation, and saving. Right now this is somewhat mixed, because _certain_ assignments will touch the database. Could this change? Besides being a general improvement (I think), it would be very helpful for nested mass assignment. For example: @user = User.find(params[:id]) @user.attributes = params[:user] @user.address.build(params[:user][:address]) if @user.save redirect_to @user else render :action => ''edit''. end Right now the `@user.address.build'' would disassociate (or destroy) an existing address, even if the @user was ultimately invalid and the new address was not saved. What I would like to see is for assigning (or building) a new address to make in-memory changes that are queued up for the final #save transaction. The association proxies, instead of updating the database, could shuffle records into arrays where the save method picked up on them and took the final action ... in a single transaction. That is, I would like to see the #save method ultimately work something like this: def save self.class.transaction do create_or_update && create_new_associated_records && disassociate_marked_associated_records && update_marked_associated_records end end I''m sure it would be a bit trickier than that (especially with new records and ids), but what do y''all think of the direction? This is something I would work on, perhaps with a bit of assistance. -Lance --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---