Changeset 4793
- Timestamp:
- 08/20/06 05:28:47 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_controller/cookies.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r4766 r4793 1 1 *SVN* 2 3 * Correct example in cookies docs. #5832 [jessemerriman@warpmail.net] 2 4 3 5 * Updated to script.aculo.us 1.6.2 [Thomas Fuchs] trunk/actionpack/lib/action_controller/cookies.rb
r2749 r4793 5 5 # 6 6 # cookies[:user_name] = "david" # => Will set a simple session cookie 7 # cookies[:login] = { :value => "XJ-122", :expires => Time.now + 360} # => Will set a cookie that expires in 1 hour 8 # 7 # cookies[:login] = { :value => "XJ-122", :expires => 1.hour.from_now } 8 # # => Will set a cookie that expires in 1 hour 9 # 9 10 # Examples for reading: 10 11 # 11 12 # cookies[:user_name] # => "david" 12 13 # cookies.size # => 2 13 # 14 # 14 15 # Example for deleting: 15 16 # … … 36 37 end 37 38 end 38 39 39 40 class CookieJar < Hash #:nodoc: 40 41 def initialize(controller) … … 49 50 @cookies[name.to_s].value.first if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value) 50 51 end 51 52 52 53 def []=(name, options) 53 54 if options.is_a?(Hash) … … 57 58 options = { "name" => name.to_s, "value" => options } 58 59 end 59 60 60 61 set_cookie(options) 61 62 end 62 63 63 64 # Removes the cookie on the client machine by setting the value to an empty string 64 65 # and setting its expiration date into the past