Permalink
Browse files

Fixed CgiRequest so that it'll now accept session options with Symbol…

…s as keys (as the documentation points out) [Suggested by Andreas]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@117 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 9ee94ab commit 6b284b87f224d8d4da074f98553ec9394f3d4c57 @dhh dhh committed Dec 12, 2004
View
@@ -1,5 +1,12 @@
*SVN*
+* Fixed CgiRequest so that it'll now accept session options with Symbols as keys (as the documentation points out) [Suggested by Andreas]
+
+* Added that render_partial will always by default include a counter with value 1 unless there is a counter passed in via the
+ local_assigns hash that overrides it. As a result, render_collection_of_partials can still be written in terms of render_partial
+ and partials that make use of a counter can be called without problems from both render_collection_of_partials as well as
+ render_partial #295 [marcel]
+
* Fixed CgiRequest#out to fall back to #write if $stdout doesn't have #syswrite [bitsweat]
* Fixed all helpers so that they use XHTML compliant double quotes for values instead of single quotes [htonl/bitsweat]
@@ -120,6 +127,7 @@
* Fixed that link_to would escape & in the url again after url_for already had done so
+
*0.9.5* (28)
* Added helper_method to designate that a given private or protected method you should available as a helper in the view. [bitsweat]
@@ -36,7 +36,7 @@ class CgiRequest < AbstractRequest #: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 @@ def host
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 @@ def method_missing(method_id, *arguments)
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:
@@ -41,7 +41,7 @@ def [](name)
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 }

0 comments on commit 6b284b8

Please sign in to comment.