title: Invalid Authenticity Token in form even though it's present
body: <p>I'm having an issue with a form that returns</p>
  
  <pre><code>ActionController::InvalidAuthenticityToken
  </code></pre>
  
  <p>still my params have it present</p>
  
  <pre><code>{"utf8"=&gt;"✓", "_method"=&gt;"patch", "authenticity_token"=&gt;"ovSc3ZMU8fGTkHileMaQpchm2bAjNz+TO46xTfUFHqP2wckumC8tMefgUQ/UIHRb1323o9YeSDfQMxTAQhDdgg==", "driver_request"=&gt;{"accepted"=&gt;"true"}, "commit"=&gt;"Accepted", "controller"=&gt;"driver_requests", "action"=&gt;"update", "driver_id"=&gt;"1", "id"=&gt;"40"}
  </code></pre>
  
  <p>the form looks like this, and have a hidden token field present, when I inspect it:</p>
  
  <pre><code>    &lt;%= form_for([current_driver, driver_request]) do |f| %&gt;
        &lt;%= f.hidden_field :accepted, value: true %&gt;
        &lt;%= f.submit 'Accepted', class: 'btn btn-primary' %&gt;
      &lt;% end %&gt;
  </code></pre>
  
  <p>where I think the issue might come from is the way I render the form. I'm using rails 5 and they now let you access <code>ApplicationController</code> and I'm calling on a partial that is a modal, with the form in it - like this:</p>
  
  <pre><code> ApplicationController.renderer.render(partial: 'driver_requests/driver_request', locals: { driver_request: request, current_driver: request.driver })
  </code></pre>
  
  <p>now obviously I don't want to disable authenticity tokens, so I'm trying to find a way to debug this - but frankly I'm very unsure on how to fix this - as the token is actually present.</p>
  
  <p><strong>Update: temporary solution:</strong></p>
  
  <p>I got this working by making the form use AJAX. I think it has to do with the fact that I render a partial from <code>ApplicationController</code> and that the partial is thus not able to get the <code>csrf_meta_tag</code>. Still, this is just speculation.</p>