ruby on rails - AJAX call log out my account -


i have rails 3 app , using warden authentication. works fine when try use ajax(post) access 1 of controller application log out account , ask me log in again.

this because of rails csrf token validation. there few different ways deal this:

  1. hacky, dirty shortcut - make ajax call use http instead of post. not csrf token default
  2. another dirty shortcut - turn off csrf validation particular action in controller

    protect_from_forgery :except => :create 
  3. properly implement csrf token ajax calls, there many guides out there, example this one or this one


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -