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

Changeset 110

Show
Ignore:
Timestamp:
12/10/04 17:16:11 (4 years ago)
Author:
david
Message:

Fixed problem with cookies not being set to path=/ by default and a test buggerboo

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/actionpack/lib/action_controller/cookies.rb

    r93 r110  
    4545        options["name"] = name.to_s 
    4646      else 
    47         options = [ name, options ] 
     47        options = { "name" => name, "value" => options } 
    4848      end 
    4949       
     
    5858    private 
    5959      def set_cookie(name, options) #:doc: 
    60         cookie = options.is_a?(Array) ? CGI::Cookie.new(*options) : CGI::Cookie.new(options) 
     60        options["path"] = "/" unless options["path"] 
     61        cookie = CGI::Cookie.new(options) 
    6162        @controller.logger.info "Cookie set: #{cookie}" unless @controller.logger.nil? 
    6263        @controller.response.headers["cookie"] << cookie 
  • trunk/actionpack/test/template/url_helper_test.rb

    r105 r110  
    3030  def test_link_to_image 
    3131    assert_equal( 
    32       "<a href=\"http://www.world.com\"><img alt=\"Rss\" height=\"45\" src=\"/images/rss.png\" width=\"30\" /></a>",  
     32      "<a href=\"http://www.world.com\"><img alt=\"Rss\" border=\"0\" height=\"45\" src=\"/images/rss.png\" width=\"30\" /></a>",  
    3333      link_to_image("rss", "http://www.world.com", "size" => "30x45") 
    3434    ) 
    3535 
    3636    assert_equal( 
    37       "<a class=\"admin\" href=\"http://www.world.com\"><img alt=\"Feed\" height=\"45\" src=\"/images/rss.gif\" width=\"30\" /></a>",  
     37      "<a class=\"admin\" href=\"http://www.world.com\"><img alt=\"Feed\" border=\"0\" height=\"45\" src=\"/images/rss.gif\" width=\"30\" /></a>",  
    3838      link_to_image("rss.gif", "http://www.world.com", "size" => "30x45", "alt" => "Feed", "class" => "admin") 
    3939    )