diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2014-02-08 10:00:09 -0800 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2014-02-08 10:00:09 -0800 |
commit | 77577149f71e1fa0df15dbc02ae7c33349dddba8 (patch) | |
tree | c083c6ec061e54df0e302d6e2bb26c4e59acedd0 | |
parent | 50d828c0afe9c0fb94d4c1e86fb6c71916a32ab6 (diff) | |
download | rails-77577149f71e1fa0df15dbc02ae7c33349dddba8.tar.gz rails-77577149f71e1fa0df15dbc02ae7c33349dddba8.tar.bz2 rails-77577149f71e1fa0df15dbc02ae7c33349dddba8.zip |
Updated the cookie docs to use the safer JSON.{generate,parse}
cc @senny
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/cookies.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 3d1614142d..531654895b 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -24,7 +24,7 @@ module ActionDispatch # 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 @@ module ActionDispatch # # 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: # |