diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-11-26 02:09:38 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-11-26 02:09:38 +0000 |
commit | defda16b834ffc4a78def1c4b6c2299b754fe901 (patch) | |
tree | ceb7721e9d2a0129d2dc94a5e74fed02e381678f /actionpack/lib | |
parent | d0c90331f19004f9f297989785f1516631ea0fc3 (diff) | |
download | rails-defda16b834ffc4a78def1c4b6c2299b754fe901.tar.gz rails-defda16b834ffc4a78def1c4b6c2299b754fe901.tar.bz2 rails-defda16b834ffc4a78def1c4b6c2299b754fe901.zip |
Allow symbols to be used as keys for setting cookies
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@21 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/cookies.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/cookies.rb b/actionpack/lib/action_controller/cookies.rb index 78815b7bc4..d56096818d 100644 --- a/actionpack/lib/action_controller/cookies.rb +++ b/actionpack/lib/action_controller/cookies.rb @@ -4,14 +4,14 @@ module ActionController #:nodoc: # itself back -- just the value it holds). Examples for writting: # # cookies["user_name"] = "david" # => Will set a simple session cookie - # cookies["login"] = { "value" => "XJ-122", "expires" => Time.now + 360} # => Will set a cookie that expires in 1 hour + # cookies["login"] = { :value => "XJ-122", :expires => Time.now + 360} # => Will set a cookie that expires in 1 hour # # Examples for reading: # # cookies["user_name"] # => "david" # cookies.size # => 2 # - # All the options for setting cookies are: + # All the option symbols for setting cookies are: # # value:: the cookie's value or list of values (as an array). # path:: the path for which this cookie applies. Defaults to the root of the application. @@ -41,6 +41,7 @@ module ActionController #:nodoc: def []=(name, options) if options.is_a?(Hash) + options.each { |key, value| options[key.to_s] = value } options["name"] = name else options = [ name, options ] |