Note that there are some explanatory texts on larger screens.

plurals
  1. POStrong_parameters in view with mixed models
    primarykey
    data
    text
    <p>I am using strong parameters and when I try to save the following form I get the following message. </p> <p>undefined method `household_params' for # '&lt;'VisitsController:0x007fa88deec428'>'</p> <p>I am confused because I am using the visits controller and not the households controller - The visit is associated with a household as shown below and I call the view with the following code:</p> <pre><code>= link_to 'New Visit', {controller: 'visits', action: 'new', household_id: household.id, method: 'post'}, class: 'btn btn-primary' </code></pre> <p>The Form is:</p> <pre><code>%h3 Household: #{household.name} %h4 Household Members: #{household.neighbors.count} %h4 Visits: #{household.visits.count} = simple_form_for visit do |f| = f.input :visited_on, :label =&gt; 'Visited On', as: :date_picker, input_html: { class: 'span2' } = f.input :starch, :label =&gt; false, collection: ['Beans','Rice','Potatoes'],selected: 'Beans' = f.input :cereal, :label =&gt; false, collection: ['Cereal','Grits','Oatmeal'] = f.input :option1, :label =&gt; false, collection: ['Peanut Butter Jelly', 'Deserts','Baby Fromula'], prompt: 'Options' = f.input :items_received, :label =&gt; 'Special Needs',input_html: {rows: 4, class: 'span9' } = f.input :notes, :label =&gt; 'Notes',input_html: {rows: 4, class: 'span9' } = f.button :submit, :class =&gt; 'btn-primary', :label=&gt; 'Save' </code></pre> <p>The form works fine without the three lines that display information about the household </p> <p>I am thinking strong_parameters is getting confused </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload