On 4/17/06, Francois Beausoleil <[EMAIL PROTECTED]> wrote:
> Hello everyone !
>
> I'm just wondering what your expectations would be if you saw that code:
>
> def edit
>   @contact = Contact.find(params[:id])
>   @contact.phone.attributes = params[:phone]
>   return if @contact.update_attributes(params[:contact])
>   # handle validation errors
> end
>
> What do you expect the phones table to contain:  the old values or the
> new values ?
>
> I expected the new values, and I expected AR:B to save the child
> object during the parent object's transaction.  What actually happens
> is AR:B reloads the relations, thereby destroying the values that I
> just set...
>
> So, what should be the expected behavior here ?
>
> Thanks !
> --
> François Beausoleil
> http://blog.teksol.info/

AR has never saved child objects automatically to my knowledge.  I
usually put both saves in a transaction.

--
Rick Olson
http://techno-weenie.net
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to