On 25 Dec 2008, at 01:08, Paulo Abreu wrote:
>
> Imagine that I have the following objects:
>
> class Person < ActiveRecord::Base
> has_one :nose
> end
>
> class Nose < ActiveRecord::Base
> end
>
> p = Person.new
> p.name = "Mary"
> p.nose = Nose.new
> p.save
>
> p.nose.colour = "white"
> p.save
>
> Why in the last p.save, p.nose.colour is not persisted in database? Is
> there any way of doing this in an automatic way?
Because p.save only saves child objects if they are unsaved.
Fred>
>
> Regards,
>
> Paulo Abreu
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---