How to set default cookie domain in Rails3

I want to set default cookie domain for my application to
“.mydomain.com” to allow cookie session be preserved across
subdomains.
I use => config.action_dispatch.session = {:domain =>
“.mydomain.com”} in application.rb, but thats not working. The cookie
is saved as ‘mydomain.com

Thanks for the help!

Jabulani wrote:

I want to set default cookie domain for my application to
“.mydomain.com” to allow cookie session be preserved across
subdomains.
I use => config.action_dispatch.session = {:domain =>
“.mydomain.com”} in application.rb, but thats not working. The cookie
is saved as ‘mydomain.com

Thanks for the help!

Try: Rails.application.config.session_store :cookie_store,
:key => ‘_app_session’,
:domain => ‘.mydomain.com’

I coved this in a blog post as we ran across this issue today:
http://blog.bitzesty.com/rails-3-default-cookie-domain-for-subdomains