I\'m trying to submit a form to 2 tables but somehow I got this syntax error unexpected \'\\n\'
at this line joins: [\'sources\'], :landslide_id
and
found unpermitted parameter: sources
Based on your form, it looks like sources are inside a param called sources rather than sources_attributes. Edit your landslide_params
, changing sources_attributes
to sources.
May I ask what set_landslide
is trying to render, or correct me if I am wrong below? Placing joins
on a new line causes the error. I am thinking you're trying to do something like:
landslide = Landslide.find(params[:total_id])
render json: landslide.to_json(:include => { :sources => { landslide_params[:sources] }})
Which would give you a json with the landslide object and a sources array. The landslide id should be within the landslide object. This of course assumes that's what you were going for.