Hi, A cookie is set in the browser which will identify a particular session file to look at. The default prefix for the session files is "ruby_sess." If you use the same browser to access 2 different Rails applications on the same server (eg. localhost) they appear to share the same session file. This causes problems when one app tries to access its model, but gets the other app''s instead. This can be rectified by specifying a unique prefix in the environment.rb of each application. ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:prefix => ''uniquenappname.'') Is there anyway we can set a more unique prefix in actionpack-1.7.0/lib/action_controller/cgi_process.rb? Thanks. Jon -- http://www.snowblink.co.uk/
Jon Lim wrote: > Is there anyway we can set a more unique prefix in > actionpack-1.7.0/lib/action_controller/cgi_process.rb? Not really answering your question, but if I''m reading the CGI docs right, you can set :session_path so that cookies from each app will only be available under the given path. This should make it possible to have multiple versions of the same app in different directories with no conflict. -- Lee
Lee O''Mara wrote:> Jon Lim wrote: >> Is there anyway we can set a more unique prefix in >> actionpack-1.7.0/lib/action_controller/cgi_process.rb? > > Not really answering your question, but if I''m reading the CGI docs > right, you can set :session_path so that cookies from each app will only > be available under the given path. This should make it possible to have > multiple versions of the same app in different directories with no > conflict.Here''s a direct way to configure CGI session for your app. Add to the end of config/environment.rb ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update( :prefix => ''myapp.'', :database_manager => CGI::Session::ActiveRecordStore ) The available options are documented at http://rails.rubyonrails.com/classes/ActionController/Base.html#M000170 Best, jeremy
Thanks Lee and Jeremy. Configuring environment.rb is the way I can see to do it at the moment. I was wondering if cgi_process.rb could be altered to give out more unique prefixes from the start - without adding additional config to environment.rb. Cheers, Jon -- http://www.snowblink.co.uk/