Permalink
Browse files

Improve signed cookies documentation

  • Loading branch information...
1 parent a719843 commit 3527852dba6e68eca1c4ed3d8024c10e6a0ec008 @cjolly cjolly committed Apr 21, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 actionpack/lib/action_dispatch/middleware/cookies.rb
@@ -29,6 +29,7 @@ def cookie_jar
# # 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.
# # 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
#
# # Sets a "permanent" cookie (which expires in 20 years from now).
@@ -39,9 +40,10 @@ def cookie_jar
#
# Examples for reading:
#
- # cookies[:user_name] # => "david"
- # cookies.size # => 2
- # cookies[:lat_lon] # => [47.68, -122.37]
+ # cookies[:user_name] # => "david"
+ # cookies.size # => 2
+ # cookies[:lat_lon] # => [47.68, -122.37]
+ # cookies.signed[:login] # => "XJ-122"
#
# Example for deleting:
#

0 comments on commit 3527852

Please sign in to comment.