Ruby on Rails Monday, February 2, 2015

Hi,

I've got some basic form:

    <%= form_for(@task, remote: true, html: {'data-type' => 'html'}) do |f| %>
      <%= f.text_field :text %>
      <%= f.submit %>
    <% end %>

But when I submit it with no javascript enabled, I get:

    Started POST "/tasks" for ::1 at 2015-02-02 23:38:27 +0200
    Processing by TasksController#create as HTML
      Parameters: {"utf8"=>"✓", "task"=>{"text"=>"adsf"}, "commit"=>"Create Task"}
    Can't verify CSRF token authenticity
    Completed 422 Unprocessable Entity in 5ms

    ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken):
      actionpack (4.2.0) lib/action_controller/metal/request_forgery_protection.rb:181:in `handle_unverified_request'
    ...

How do I remedy this?

Regards,
Yuri

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b186ca64-13da-4e5a-8c12-ea83f03e1c18%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment