Browse files

Updated the cookie docs to use the safer JSON.{generate,parse}

  • Loading branch information...
1 parent eebb813 commit a373ec727f94fedfd9a64bff6c040b42880c46b9 @chancancode chancancode committed Feb 8, 2014
Showing with 5 additions and 5 deletions.
  1. +5 −5 actionpack/lib/action_dispatch/middleware/cookies.rb
View
10 actionpack/lib/action_dispatch/middleware/cookies.rb
@@ -24,7 +24,7 @@ def cookie_jar
# cookies[:user_name] = "david"
#
# # Cookie values are String based. Other data types need to be serialized.
- # cookies[:lat_lon] = JSON.dump([47.68, -122.37])
+ # cookies[:lat_lon] = JSON.generate([47.68, -122.37])
#
# # Sets a cookie that expires in 1 hour.
# cookies[:login] = { value: "XJ-122", expires: 1.hour.from_now }
@@ -42,10 +42,10 @@ def cookie_jar
#
# Examples of reading:
#
- # cookies[:user_name] # => "david"
- # cookies.size # => 2
- # JSON.load(cookies[:lat_lon]) # => [47.68, -122.37]
- # cookies.signed[:login] # => "XJ-122"
+ # cookies[:user_name] # => "david"
+ # cookies.size # => 2
+ # JSON.parse(cookies[:lat_lon]) # => [47.68, -122.37]
+ # cookies.signed[:login] # => "XJ-122"
#
# Example for deleting:
#

0 comments on commit a373ec7

Please sign in to comment.