title: Rails 4 permit nested hash with dynamic keys
body: <p>Facing issues in permitting nested hash with dynamic keys in params. I have referred other similar questions on stack overflow but no luck so far. Any help is greatly appreciated. Below is the error raised.</p>
  
  <p><strong>ActionController::UnpermittedParameters</strong> found unpermitted parameters: volunteers_slots_attributes, sign_up_slots_attributes</p>
  
  <pre><code>{"event"=&gt;{
  "name"=&gt;"ss", 
  "volunteers_slots_attributes"=&gt;{
  "0"=&gt;{"_destroy"=&gt;"false", "needed_count"=&gt;""},
  "1"=&gt;{"_destroy"=&gt;"false", "needed_count"=&gt;""},
  ... 
  }, 
  "sign_up_slots_attributes"=&gt;{
  "0"=&gt;{"_destroy"=&gt;"false", "title"=&gt;"", "quantity"=&gt;""}, 
  "1"=&gt;{"_destroy"=&gt;"false", "title"=&gt;"", "quantity"=&gt;""}, 
  "2"=&gt;{"_destroy"=&gt;"false", "title"=&gt;"", "quantity"=&gt;""},
   .... 
  }, 
  "supplies_note"=&gt;""}}
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code> def event_params
      params[:event].permit(:name,:supplies_note,
      :volunteers_slots_attributes,
      :sign_up_slots_attributes)
   end
  </code></pre>
  
  <p>Event Model:</p>
  
  <pre><code>  accepts_nested_attributes_for :sign_up_slots, allow_destroy: true, reject_if: :all_blank
    accepts_nested_attributes_for :volunteers_slots, allow_destroy: true, reject_if: :all_blank
  </code></pre>