aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/cgi_process.rb8
-rw-r--r--actionpack/lib/action_controller/cookies.rb2
2 files changed, 7 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/cgi_process.rb b/actionpack/lib/action_controller/cgi_process.rb
index 148cb81df0..64bfc1ed07 100644
--- a/actionpack/lib/action_controller/cgi_process.rb
+++ b/actionpack/lib/action_controller/cgi_process.rb
@@ -36,7 +36,7 @@ module ActionController #:nodoc:
attr_accessor :cgi
DEFAULT_SESSION_OPTIONS =
- { "database_manager" => CGI::Session::PStore, "prefix" => "ruby_sess.", "session_path" => "/" }
+ { :database_manager => CGI::Session::PStore, :prefix => "ruby_sess.", :session_path => "/" }
def initialize(cgi, session_options = {})
@cgi = cgi
@@ -67,7 +67,7 @@ module ActionController #:nodoc:
def session
return @session unless @session.nil?
begin
- @session = (@session_options == false ? {} : CGI::Session.new(@cgi, DEFAULT_SESSION_OPTIONS.merge(@session_options)))
+ @session = (@session_options == false ? {} : CGI::Session.new(@cgi, session_options_with_string_keys))
@session["__valid_session"]
return @session
rescue ArgumentError => e
@@ -94,6 +94,10 @@ module ActionController #:nodoc:
def new_session
CGI::Session.new(@cgi, DEFAULT_SESSION_OPTIONS.merge(@session_options).merge("new_session" => true))
end
+
+ def session_options_with_string_keys
+ DEFAULT_SESSION_OPTIONS.merge(@session_options).inject({}) { |options, pair| options[pair.first.to_s] = pair.last; options }
+ end
end
class CgiResponse < AbstractResponse #:nodoc:
diff --git a/actionpack/lib/action_controller/cookies.rb b/actionpack/lib/action_controller/cookies.rb
index 1eb071bdbe..6b9954f84d 100644
--- a/actionpack/lib/action_controller/cookies.rb
+++ b/actionpack/lib/action_controller/cookies.rb
@@ -41,7 +41,7 @@ module ActionController #:nodoc:
def []=(name, options)
if options.is_a?(Hash)
- options.each { |key, value| options[key.to_s] = value }
+ options = options.inject({}) { |options, pair| options[pair.first.to_s] = pair.last; options }
options["name"] = name.to_s
else
options = { "name" => name, "value" => options }