Evan Sparkman
Evan Sparkman

Reputation:

Ruby on Rails 2.1 Subdomain-Cookie issues

When using a subdomain and trying to view anything related to current_user. user is sent to a new session page, the page shows the session is created and gives the option to logout. I can use no subdomain and it works fine.

Upvotes: 2

Views: 1362

Answers (3)

Noah W. Smith
Noah W. Smith

Reputation: 79

@jkrall - to add to that, the whole options hash moved to :key, :secret, and :domain vs :session_key, :session_domain, etc.

Upvotes: 0

jkrall
jkrall

Reputation: 536

FYI... as of Rails 2.3, this setting has changed. The rails 2.3+ version looks like:

ActionController::Base.session_options[:domain] = '.domain.com'

Just in case anyone else lands here from Google and gets confused like I did.

Upvotes: 1

Kevin H
Kevin H

Reputation: 76

Set it in your environment.rb (or environments/*.rb if you'll use different domains for each environment):

ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update( :session_domain => '.domain.com')

Upvotes: 1

Related Questions