Hi,
I have a form model which has_many form_item objects. How do I build
a new form model from these objects? This call
@form = Form.new(:user_id => session[:user_id],
:form_items => params[:form_items])
is giving me the error, “ActiveRecord::AssociationTypeMismatch in
FormsController#create – FormItem expected, got
HashWithIndifferentAccess”. request passed in is
{“commit”=>“Submit Form”,
“form_items”=>[{“description”=>“aaa”,
“prescription_number”=>“111”,
“day_supply”=>“234”}]}
Below is the partial I’m using to collect form_item data:
<% fields_for “form[form_item_attributes][]”, form_item do |
form_item_form| %>
Thanks for your help, - Dave