diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2004-11-26 02:11:42 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2004-11-26 02:11:42 +0000 |
commit | 177cae5483736e20bc8b1f878a4f1a52eed26a10 (patch) | |
tree | 4d0d8869daefde328f4db1904c6a7eb2f4bdd09e /actionpack | |
parent | defda16b834ffc4a78def1c4b6c2299b754fe901 (diff) | |
download | rails-177cae5483736e20bc8b1f878a4f1a52eed26a10.tar.gz rails-177cae5483736e20bc8b1f878a4f1a52eed26a10.tar.bz2 rails-177cae5483736e20bc8b1f878a4f1a52eed26a10.zip |
Allow symbols to be used as names for setting cookies
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@22 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/cookies.rb | 4 | ||||
-rw-r--r-- | actionpack/test/controller/cookie_test.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/actionpack/lib/action_controller/cookies.rb b/actionpack/lib/action_controller/cookies.rb index d56096818d..b23bb74f88 100644 --- a/actionpack/lib/action_controller/cookies.rb +++ b/actionpack/lib/action_controller/cookies.rb @@ -36,13 +36,13 @@ module ActionController #:nodoc: # Returns the value of the cookie by +name+ -- or nil if no such cookie exist. You set new cookies using either the cookie method # or cookies[]= (for simple name/value cookies without options). def [](name) - @cookies[name].value if @cookies[name] + @cookies[name.to_s].value if @cookies[name.to_s] end def []=(name, options) if options.is_a?(Hash) options.each { |key, value| options[key.to_s] = value } - options["name"] = name + options["name"] = name.to_s else options = [ name, options ] end diff --git a/actionpack/test/controller/cookie_test.rb b/actionpack/test/controller/cookie_test.rb index 41dc3393f1..3f9dafacd6 100644 --- a/actionpack/test/controller/cookie_test.rb +++ b/actionpack/test/controller/cookie_test.rb @@ -18,7 +18,7 @@ class CookieTest < Test::Unit::TestCase end def authenticate_for_fourten_days_with_symbols - cookies["user_name"] = { :value => "david", :expires => Time.local(2005, 10, 10) } + cookies[:user_name] = { :value => "david", :expires => Time.local(2005, 10, 10) } render_text "hello world" end |