Created
March 22, 2012 13:14
-
-
Save bonyiii/2158289 to your computer and use it in GitHub Desktop.
Rails ajax link_to remote with put, post
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://www.kolodvor.net/2010/01/02/rails-csrf-and-ajax-requests/ | |
http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection/ClassMethods.html#M000514 | |
http://stackoverflow.com/questions/5241213/rails-session-is-blank-when-using-http-put | |
Key thing is to add form_authenticity_token to path param as a query_string | |
http://api.rubyonrails.org/classes/ActionView/Helpers/UrlHelper.html#method-i-link_to | |
<%= link_to 'Reset', null_counter_model_path(model, :authenticity_token => form_authenticity_token), :confirm => 'Are you sure?', :method => :put, :remote => true %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment