title: How to make an optional strong parameters key but filter nested params?
body: <p>I have this in my controller:</p>
  <pre><code>params.require(:item).permit!
  </code></pre>
  <p>Let's assume this rspec spec, which works as expected:</p>
  <pre><code>put :update, id: @item.id, item: { name: &quot;new name&quot; }
  </code></pre>
  <p>However, the following causes <code>ActionController::ParameterMissing</code>:</p>
  <pre><code>put :update, id: @item.id, item: nil
  </code></pre>
  <p>It has to do with controller macros that I use for other actions and through which I cannot control the params being sent (the macros checks for user credentials, so I don't really care about actually testing an <code>#update</code> action, rather I just test before_filters for it).</p>
  <p>So my question is: <strong>How do I make <code>params[:item]</code> optional, yet still filter attributes within it if it's present?</strong></p>