I'm using UJS to handle a form submit with ajax. The form has a file input in it. I'm getting an invalid authenticity token error from the controller that receives it. Am I forgetting some attribute here either on the form or file tag?
ActionController::InvalidAuthenticityToken
<%= form_for @block,
remote: true,
html: { id: "userInputForm", class: "form" } do |f| %>
<%= f.file_field :something_to_replace %>
<% end %>
This is a Rails bug. To work around it, you have two options:
config.action_view.embed_authenticity_token_in_remote_forms = true
in your config/application.rb
authenticity_token: true
to your form_for
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With