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.