ruby on rails - File upload field causing ActionController::InvalidAuthenticityToken exception -


using rails 4, , trying add file field existing form, using simple_form , paperclip.

here's critical part of form:

<%= simple_form_for(@employee, html: { class: 'form-horizontal requires', multipart: true}, remote: true) |f| %>      <%= f.input :avatar %>  <% end %> 

everything works ok, unless submit form uploaded file. then, this:

actioncontroller::invalidauthenticitytoken in employeescontroller#update 

what doing wrong here?

the simplest solution add authenticity_token: true form. this:

<%= form_for @employee, html: { class: 'form-horizontal requires'}, multipart: true, remote: true, authenticity_token: true  |f| %>   <%= f.input :avatar %> <% end %> 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -