I setup the cookie store to domain => :all, like I possibly could get in documentation also it appears to operate, because devise's authentication works over the multiple domain.

MyApp::Application.config.session_store :cookie_store, :key => '_MyApp.com_session', :domain => :all

However, if I'm trying myself to create to some cookie, it always write lower the sub domain... I do not have it:

enter image description here

I write the cookie within the easiest manner possible:

 snacks.permanent[:remember_locale] = locale

But regardless of what it will not place it for that top level domain whereas the main one came by devise appears to handle it with no problem :(


ps: I'm using rails 3..3

The configuration for that session_store only is applicable towards the session cookie. When setting another cookie you need to specify the domain for your cookie too.

snacks.permanent[:remember_locale] = 

Note (drawn from rails source):

  # Please be aware when you specify a :domain when setting a cookie, you have to also specify the domain when removing the cookie:


  #  snacks[:key] = tasty cookie',

  #    :expires => 1.year.from_now,

  #    :domain => 'domain.com'



  #  snacks.remove(:key, :domain => 'domain.com')