Getting AssociationTypeMismatch error when trying to create new object


I’m trying to create a model, named “form”, which has_many “form_item”
objects. The code is

            @form = => session[:user_id],
                             :form_items => params[:form_items])

but I get an error, even though I thought I was passing in the
expected form_item …

ActiveRecord::AssociationTypeMismatch in FormsController#create

FormItem expected, got HashWithIndifferentAccess



{“commit”=>“Submit Form”,

Thanks for any input, - Dave

On 11 Aug 2008, at 18:29, [email protected] wrote:

expected form_item …

Same answer as last time you asked:
Right now, you’re going to have to iterate over params[:form_items]
creating activerecord objects as you go. ( is expecting
form_items to actually be an Array of FormItem objects)