From 77577149f71e1fa0df15dbc02ae7c33349dddba8 Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Sat, 8 Feb 2014 10:00:09 -0800 Subject: [PATCH] Updated the cookie docs to use the safer JSON.{generate,parse} cc @senny --- actionpack/lib/action_dispatch/middleware/cookies.rb | 10 +++++----- 1 file 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: #