提交 77577149 编写于 作者: G Godfrey Chan

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

cc @senny
上级 50d828c0
......@@ -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:
#
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册