Can you try like this <%= form_for(@task, remote: true, authenticity_token: 
true,  html: {'data-type' => 'html'}) do |f| %>

Thanks
Vishnu

On Tuesday, 3 February 2015 01:42:37 UTC+4, Yuri Kanivetsky wrote:
>
> 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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/a6ed62b5-7ed2-4337-86a7-6e165c096739%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to