When I create a child record I’m not automagically getting the parent ID
put into the fk field. Does object.new take parameters that allows me
to do that as part of the AR record creation? Or do I need to do it
separately? Or am I missing the boat altogether
The parent already exists. I’m create the child, then update some of
its fields with the params returned from a form. I’ve included some of
the code below (shistory_item’s ‘emrec_id’ field is declared ‘not
null’) The app’s crashing on the ‘update_params’ call. I’m wondering
if I can just add a parameter in the private method call, or if I have
to change its logic to add a specific assignment of the emrec_id.
Thanks in advance for any help!
Bill
relevant code from the ‘update’ method in shistory_controller.rb
private
def find_shistory
session[:shistory] ||= ShistoryItem.new
end
----- Original Message -----
From: Adam D.
To: [email protected]
Sent: 2006-03-11 12:15 PM
Subject: Re: [Rails] assignment of parent ID in child’s fk field
well if you create the child data first, you then need to associate it
to a parent. For example if you have a page with many words
Then i think you can do something along the lines of
I might be a little off here but I think thats the idea. If you post
some code then maybe we can understand what you are doing wrong.
adam
On 3/11/06, Bill W. [email protected] wrote:
When I create a child record I’m not automagically getting the
parent ID put into the fk field. Does object.new take parameters that
allows me to do that as part of the AR record creation? Or do I need to
do it separately? Or am I missing the boat altogether
Thanks,
Bill
_______________________________________________
Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails