Skip to content

Instantly share code, notes, and snippets.

@eliotsykes
Last active October 30, 2015 18:40
Show Gist options
  • Select an option

  • Save eliotsykes/d8fcacb314949a398f0d to your computer and use it in GitHub Desktop.

Select an option

Save eliotsykes/d8fcacb314949a398f0d to your computer and use it in GitHub Desktop.
Avoid cookies in Rails 4.2 API Controller
class Api::ApiController < ActionController::Base
protect_from_forgery with: :null_session
def self.disable_turbolinks_cookies
skip_before_action :set_request_method_cookie
end
disable_turbolinks_cookies
end
@eliotsykes
Copy link
Author

API responding with Set-Cookie header?

It might be turbolinks setting a request_method cookie.

Use skip_before_action :set_request_method_cookie to stop turbolinks setting cookies on your API responses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment