Skip to content

Commit

Permalink
Resolving LH #5986, cookies doc updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Aditya Sanghi authored and fxn committed Nov 27, 2010
1 parent 550ac57 commit abe28bf
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions actionpack/lib/action_dispatch/middleware/cookies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,31 @@ def cookie_jar
# Examples for writing:
#
# # Sets a simple session cookie.
# # This cookie will be deleted when the user's browser is closed.
# cookies[:user_name] = "david"
#
# # Assign an array of values to a cookie.
# cookies[:lat_lon] = [47.68, -122.37]
#
# # Sets a cookie that expires in 1 hour.
# cookies[:login] = { :value => "XJ-122", :expires => 1.hour.from_now }
#
# # Sets a signed cookie, which prevents a user from tampering with its value.
# # You must specify a value in ActionController::Base.cookie_verifier_secret.
# cookies.signed[:remember_me] = [current_user.id, current_user.salt]
# # 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.
# cookies.signed[:user_id] = current_user.id
#
# # Sets a "permanent" cookie (which expires in 20 years from now).
# cookies.permanent[:login] = "XJ-122"
#
# # You can also chain these methods:
# cookies.permanent.signed[:login] = "XJ-122"
#
# Examples for reading:
#
# cookies[:user_name] # => "david"
# cookies.size # => 2
# cookies[:lat_lon] # => [47.68, -122.37]
#
# Example for deleting:
#
Expand Down Expand Up @@ -275,7 +282,7 @@ def ensure_secret_secure(secret)
"integrity hash for cookie session data. Use " +
"config.secret_token = \"some secret phrase of at " +
"least #{SECRET_MIN_LENGTH} characters\"" +
"in config/application.rb"
"in config/initializers/secret_token.rb"
end

if secret.length < SECRET_MIN_LENGTH
Expand Down

0 comments on commit abe28bf

Please sign in to comment.