提交 3527852d 编写于 作者: C Chad Jolly

Improve signed cookies documentation

上级 a719843d
...@@ -29,6 +29,7 @@ def cookie_jar ...@@ -29,6 +29,7 @@ def cookie_jar
# # Sets a signed cookie, which prevents a user from tampering with its value. # # Sets a signed cookie, which prevents a user from tampering with its value.
# # The cookie is signed by your app's <tt>config.secret_token</tt> value. # # The cookie is signed by your app's <tt>config.secret_token</tt> value.
# # Rails generates this value by default when you create a new Rails app. # # Rails generates this value by default when you create a new Rails app.
# # Signed cookies must read with the signed method <tt>cookies.signed[:key]</tt>
# cookies.signed[:user_id] = current_user.id # cookies.signed[:user_id] = current_user.id
# #
# # Sets a "permanent" cookie (which expires in 20 years from now). # # Sets a "permanent" cookie (which expires in 20 years from now).
...@@ -39,9 +40,10 @@ def cookie_jar ...@@ -39,9 +40,10 @@ def cookie_jar
# #
# Examples for reading: # Examples for reading:
# #
# cookies[:user_name] # => "david" # cookies[:user_name] # => "david"
# cookies.size # => 2 # cookies.size # => 2
# cookies[:lat_lon] # => [47.68, -122.37] # cookies[:lat_lon] # => [47.68, -122.37]
# cookies.signed[:login] # => "XJ-122"
# #
# Example for deleting: # Example for deleting:
# #
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册