I am submitting a form in Rails4 from Modal. This solution was working fine in Rails 3.x
The code is as following:
 <div class="modal fade" id="copy-product-addons">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h4>Copy Add-Ons From:</h4>
      </div>
      <div class="modal-body">
        <form id="addons-copy" method="POST" action="<%= copy_addons_product_path(@product) %>">
          <%= select_tag "from", options_from_collection_for_select(@shop.enabled_products - [@product], 'id', 'name'),  :class => "form-control %>
        </form>
      </div>
      <div class="modal-footer">
        <a href="#" class="btn btn-danger" data-dismiss="modal">Cancel</a>
        <a href="#" onclick="$('#addons-copy').submit(); return false;" class="btn btn-primary">Copy Add-ons</a>
      </div>
    </div>
  </div>
</div>
<% end %>
As a response, instead of executing specific action it re-directs me to Login page by login me out.
The response in terminal looks like:
> Started POST "/products/10168/copy_addons" for 127.0.0.1 at 2016-01-10
> 21:19:10 +0100 Processing by ProductsController#copy_addons as HTML  
> Parameters: {"from"=>"10130", "id"=>"10168"} Can't verify CSRF token
> authenticity Redirected to http://myr-d.dev/login Filter chain
> halted as :require_login rendered or redirected
Thank you
 
     
     
    