All threads / Using active_record_store instead of cookie_store
Ask A Question


You’re not receiving notifications from this thread.

Using active_record_store instead of cookie_store

Amit Mallick asked in Rails

I am using

MyApp::Application.config.session_store :cookie_store, key: '_myapp_session'

config.middleware.insert_before "ActionDispatch::Session::CookieStore","Rack::SSL"
config.middleware.insert_before "ActionDispatch::Cookies","Rack::SSL"

Now i want to use active_record_store for session, for which I made changes below

MyApp::Application.config.session_store :active_record_store, key: '_myapp_session'
ActiveRecord::SessionStore.session_class = MyAppSession

not sure how to make configrations in config/application.rb
i want to make sure i should able to set_cookie: '_myapp_session' in response headers, fo which "ActionDispatch::Cookies" is responsible

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 68,326+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2022 GoRails, LLC. All rights reserved.