Permalink
Browse files

Merge pull request #5924 from cjolly/signed-cookies-docs

Improve signed cookies documentation
  • Loading branch information...
2 parents 80cfb5f + 3527852 commit 89376004b103e5fbaf0e9389a57f7f298c065932 @vijaydev vijaydev committed May 6, 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 8937600

Please sign in to comment.