Using a collection_select in the view, I have added the foreign key to
the parameter list - good so far. The log file confirms this:
The model is an item (in the Items database table), the supplier_id is
the foreign key in the same table.
Parameters: {“commit”=>“Create”, “action”=>“create”,
“controller”=>“item”, “record”=>{“name”=>“My Object”,
“description”=>“Large object”, “supplier_id”=>“10001”}}
However, the next line in the log file says:
Cannot insert the value NULL into column ‘supplier_id’, table
‘RubyOnRailsTestingDB.dbo.items’; column does not allow nulls. INSERT
fails.
Can anyone explain why the supplier_id would be null in the INSERT when
the parameters list clearly shows that the supplier_id is “10001”? (As
you can see, the other parameters are inserted properly.)
Thanks in advance,
C