Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4793

Show
Ignore:
Timestamp:
08/20/06 05:28:47 (2 years ago)
Author:
bitsweat
Message:

Correct example in cookies docs. Closes #5832.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/CHANGELOG

    r4766 r4793  
    11*SVN* 
     2 
     3* Correct example in cookies docs.  #5832 [jessemerriman@warpmail.net] 
    24 
    35* Updated to script.aculo.us 1.6.2 [Thomas Fuchs] 
  • trunk/actionpack/lib/action_controller/cookies.rb

    r2749 r4793  
    55  # 
    66  #   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  # 
    910  # Examples for reading: 
    1011  # 
    1112  #   cookies[:user_name] # => "david" 
    1213  #   cookies.size         # => 2 
    13   #  
     14  # 
    1415  # Example for deleting: 
    1516  # 
     
    3637      end 
    3738  end 
    38    
     39 
    3940  class CookieJar < Hash #:nodoc: 
    4041    def initialize(controller) 
     
    4950      @cookies[name.to_s].value.first if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value) 
    5051    end 
    51      
     52 
    5253    def []=(name, options) 
    5354      if options.is_a?(Hash) 
     
    5758        options = { "name" => name.to_s, "value" => options } 
    5859      end 
    59        
     60 
    6061      set_cookie(options) 
    6162    end 
    62      
     63 
    6364    # Removes the cookie on the client machine by setting the value to an empty string 
    6465    # and setting its expiration date into the past