Skip to content

Commit

Permalink
Handle empty cookie jars gracefully -- dont pout!
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@25 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Nov 26, 2004
1 parent 55af595 commit 9e1fb32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_controller/cookies.rb
Expand Up @@ -36,7 +36,7 @@ def initialize(controller)
# Returns the value of the cookie by +name+ -- or nil if no such cookie exist. You set new cookies using either the cookie method # 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). # or cookies[]= (for simple name/value cookies without options).
def [](name) def [](name)
@cookies[name.to_s].value if @cookies[name.to_s] @cookies[name.to_s].value if @cookies.is_a?(Hash) && @cookies[name.to_s]
end end


def []=(name, options) def []=(name, options)
Expand Down

0 comments on commit 9e1fb32

Please sign in to comment.