title: Configuring strong parameters for dynamic keys
body: <p>I'm attempting to provide a form that allows an admin to edit all values of a particular model <code>Submission</code>, almost as though it was a spreadsheet.  <code>Submission</code> is comprised of one string field <code>:domain</code>.</p>
  
  <p><strong>The problem</strong> is that I can't figure out how to deal with strong params within this context.  I've found similar examples of dealing with dynamic keys like <a href="https://stackoverflow.com/a/18350078/2540204">this one</a> but I can't quite figure out how to apply them to my parameter structure.  I think I'm just not clear enough on how <code>tap</code> works.</p>
  
  <p>Here's an example of my parameters: </p>
  
  <pre><code>{"3"=&gt;{"domain"=&gt;"domain3"}, "2"=&gt;{"domain"=&gt;"domain2"}, "1"=&gt;{"domain"=&gt;"domain1"}
  </code></pre>
  
  <p>In case it helps, here's the form I'm using:</p>
  
  <pre><code>&lt;%= form_tag update_multiple_submissions_path, method: :put do %&gt;
      &lt;table data-toggle="table" data-sort-name = "domain" data-sort-order = "desc"&gt;
          &lt;thead&gt;
              &lt;th data-field="domain" data-sortable="true"&gt;Domain&lt;/th&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
              &lt;% @submissions.each do |submission| %&gt;
                  &lt;%= simple_fields_for "submissions[]", submission, defaults: {label: false} do |f| %&gt;
                      &lt;tr&gt;
                          &lt;td&gt;&lt;%= submission.domain %&gt;&lt;%= f.input :domain %&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;% end %&gt;
              &lt;% end %&gt;
          &lt;/tbody&gt;
      &lt;table&gt;
      &lt;%= submit_tag "Save" %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>And in case you're curious, here's the <code>update_multiple</code> method from my controller.  If this looks familiar, I got the outline from a railscast, which was very effective in rails3 before strong params was (were?) ubiquitous.</p>
  
  <pre><code>  def update_multiple
      logger.debug "update_multiple #{submission_params}"
      @submissions = Submission.update(submission_params[:submissions].keys, params[:submissions].values)
  
      flash[:notice] = "Updated Submissions"
  
      redirect_to review_submissions_path
    end
  </code></pre>
  
  <p>This works very well if I bypass strong prams altogether using <code>params.permit!</code> but, of course, this is an unacceptable solution.  </p>
  
  <p>Thanks for any help!</p>