aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 12:43:48 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-12 12:43:48 +0000
commit6b284b87f224d8d4da074f98553ec9394f3d4c57 (patch)
treed1f7e565b650cfb1064cd8026ed8cb51aa6e3950
parent9ee94ab13a3f02fa3097f9bd5c57ab223e3fbf97 (diff)
downloadrails-6b284b87f224d8d4da074f98553ec9394f3d4c57.tar.gz
rails-6b284b87f224d8d4da074f98553ec9394f3d4c57.tar.bz2
rails-6b284b87f224d8d4da074f98553ec9394f3d4c57.zip
Fixed CgiRequest so that it'll now accept session options with Symbols 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
-rw-r--r--actionpack/CHANGELOG8
-rw-r--r--actionpack/lib/action_controller/cgi_process.rb8
-rw-r--r--actionpack/lib/action_controller/cookies.rb2
3 files changed, 15 insertions, 3 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index d31e2f15fe..b8a491f4d8 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -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]
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 }