recursive_acronym
recursive_acronym

Reputation: 3031

Rails 3 - Ajax POSTS from a link click

I'm trying to make a link that will perform an ajax post request... the rails 3 way.

I set up my link

<%= link_to "my link", things_path(:thing_type => 1, :user_id => person.id), :remote => true, :method => "post", :format => :js %>

The post works and creates the record but it complains about missing csrf token (which is in my meta tags).

How can I get rails.js to send the csrf token when the link is clicked?

Upvotes: 0

Views: 412

Answers (1)

Krule
Krule

Reputation: 6476

As far as I remember there was a rails.js script that had this bug in Rails 3.

You should probably update your jquery-rails and regenerate rails.js or just replace rails.js with this one https://github.com/rails/jquery-ujs/blob/master/src/rails.js

Upvotes: 1

Related Questions