How to set a domain cookie domain in Rails3

I want to set the default cookie domain for my application to ".mydomain.com" in order to allow the cookie session to be stored in subdomains. There are many places showing how to do this in Rails 2.x, but these solutions do not work for Rails3. Does anyone know how I can install it?

+4
source share
1 answer

I have found a solution. There he is:

Rails.configuration.session_store :cookie_store, { :key => '_your_app_session', :domain => ".domain.com" } 

This should go to config / initializers / session_store.rb. Works great for me.

+8
source

Source: https://habr.com/ru/post/1306238/


All Articles