diff options
author | Claudio B <claudiob@users.noreply.github.com> | 2015-11-20 11:25:09 -0800 |
---|---|---|
committer | Claudio B <claudiob@users.noreply.github.com> | 2015-11-20 11:25:09 -0800 |
commit | bf7ab2f92bb63734438609853aaa5dafedfefacd (patch) | |
tree | bde555278abd63cc532333e0c19679a2a635d9e8 /actionpack | |
parent | 9b0a8b5c0317190bb7e23c18ab6def2972a9b789 (diff) | |
parent | e56d3aff24728a77df8706e38851a86d76b73f60 (diff) | |
download | rails-bf7ab2f92bb63734438609853aaa5dafedfefacd.tar.gz rails-bf7ab2f92bb63734438609853aaa5dafedfefacd.tar.bz2 rails-bf7ab2f92bb63734438609853aaa5dafedfefacd.zip |
Merge pull request #22353 from Bounga/doc_for_cookies_encrypted
Add missing example for cookies.encrypted [ci skip]
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/cookies.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb index 2889acaeb8..65baf117ba 100644 --- a/actionpack/lib/action_dispatch/middleware/cookies.rb +++ b/actionpack/lib/action_dispatch/middleware/cookies.rb @@ -77,6 +77,12 @@ module ActionDispatch # # It can be read using the signed method `cookies.signed[:name]` # cookies.signed[:user_id] = current_user.id # + # # Sets an encrypted cookie value before sending it to the client which + # # prevent users from reading and tampering with its value. + # # The cookie is signed by your app's `secrets.secret_key_base` value. + # # It can be read using the encrypted method `cookies.encrypted[:name]` + # cookies.encrypted[:discount] = 45 + # # # Sets a "permanent" cookie (which expires in 20 years from now). # cookies.permanent[:login] = "XJ-122" # @@ -89,6 +95,7 @@ module ActionDispatch # cookies.size # => 2 # JSON.parse(cookies[:lat_lon]) # => [47.68, -122.37] # cookies.signed[:login] # => "XJ-122" + # cookies.encrypted[:discount] # => 45 # # Example for deleting: # |