I have a Rails-API app. More or less "out of the box" but I want to add back cookie-based session store. Here is what I've done:
app/controllers/application_controller.rb
+ include ::ActionController::Cookies
config/application.rb
+ config.middleware.insert_after ActiveRecord::QueryCache, ActionDispatch::Cookies
+ config.middleware.insert_after ActionDispatch::Cookies, ActionDispatch::Session::CookieStore
created config/initializers/secret_token.rb
+ Namespace::Application.config.secret_token = 'token'
created config/initializers/session_store.rb
+ Namespace::Application.config.session_store :cookie_store, :key => '_namespace_key'
When I inspect the session in a controller it results:
<Rack::Session::Abstract::SessionHash:0x3fdadc5daa24 not yet loaded>
However it does appear that data is being written to and used.
But, in my browser the cookie itself is being named as '_session_id' instead of '_namespace_key'
I thought I added back every piece required for cookie based session storage, but I appear to be missing something else. Any ideas?
api_only
in the end? seems like it isn't a good solution.. – Fiat