Skip to content

Instantly share code, notes, and snippets.

@KiranPanesar
Forked from bnorton/session.rb
Last active April 22, 2019 21:57
Show Gist options
  • Save KiranPanesar/b46210da3e82c61a79f74f51e20cf854 to your computer and use it in GitHub Desktop.
Save KiranPanesar/b46210da3e82c61a79f74f51e20cf854 to your computer and use it in GitHub Desktop.
Skip the default Rails session (when building an API)
class ApplicationController < ActionController::Base
before_action :skip_session
private
def skip_session
if request.format == :json
request.session_options[:skip] = true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment