On Mon, Jan 18, 2010 at 12:09 AM, elioncho
<elioncho-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> class Message < ActiveRecord::Base
> belongs_to :author
> accepts_nested_attributes_for :author
> end
>
> I''m using the above and it''s working perfectly. The
message gets saved
> with an author_id attribute which references the author (tha author
> record gets saved too).
>
> The problem:
>
> Sometimes I don''t want to save the author because the author
already
> exists (I just want to reference it). I just want the message to get
> saved with the author_id reference. How can I override or modify the
> normal saving behaviour when using the accepts_nested_attributes_for
> method?
>
> Thanks,
>
> Elías
>
>
Elías, I would recommend taking a look at the following screencasts:
http://railscasts.com/episodes/196-nested-model-form-part-1
http://railscasts.com/episodes/197-nested-model-form-part-2
Good luck,
-Conrad
> --
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>
>
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.