Hello,
I have two models. A and B. A belongs_to B (and B has_one A). I have one form
for creating both an A and a B, so I do:
a = A.new(params[:a])
a.b = B.new(params[:b])
if a.save...
and it works as intended, both objects get saved, or none, validation happens.
But then I have the page to edit these objects. So I do:
a = A.find(a_id)
...latter on...
a.attributes = params[:a]
a.b.attributes = params[:b]
if a.save...
and there it is where it breaks. b seems to be never saved. I''m not
sure if it
is validated or not. What should I do to cascade the saves? or how should I
save these two objects?
Thank you.
--
J. Pablo Fernández <pupeno-GAtDADarczzQT0dZR+AlfA@public.gmane.org>
(http://pupeno.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---