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:
- hacky, dirty shortcut - make ajax call use http instead of post. not csrf token default
another dirty shortcut - turn off csrf validation particular action in controller
protect_from_forgery :except => :create
properly implement csrf token ajax calls, there many guides out there, example this one or this one
Comments
Post a Comment