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

Changeset 8206

Show
Ignore:
Timestamp:
11/25/07 22:24:23 (1 year ago)
Author:
david
Message:

Fixed that named routes living under resources shouldn't have double slashes (closes #10198) [isaacfeliu]

Files:

Legend:

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

    r8184 r8206  
    11*SVN* 
     2 
     3* Fixed that named routes living under resources shouldn't have double slashes #10198 [isaacfeliu] 
    24 
    35* Make sure that cookie sessions use a secret that is at least 30 chars in length. [Koz] 
  • trunk/actionpack/lib/action_controller/routing.rb

    r8169 r8206  
    10131013        path = "#{path}/" unless path[-1] == ?/ 
    10141014 
    1015         path = "/#{options[:path_prefix]}#{path}" if options[:path_prefix] 
     1015        path = "/#{options[:path_prefix].gsub(/^\//,'')}#{path}" if options[:path_prefix] 
    10161016 
    10171017        segments = segments_for_route_path(path) 
  • trunk/actionpack/test/controller/routing_test.rb

    r8169 r8206  
    19811981  end 
    19821982   
     1983  def test_named_route_in_nested_resource 
     1984    set.draw do |map| 
     1985      map.resources :projects do |project| 
     1986        project.comments 'comments', :controller => 'comments', :action => 'index' 
     1987      end 
     1988    end 
     1989     
     1990    request.path = "/projects/1/comments" 
     1991    request.method = :get 
     1992    assert_nothing_raised { set.recognize(request) } 
     1993    assert_equal("comments", request.path_parameters[:controller]) 
     1994    assert_equal("index", request.path_parameters[:action]) 
     1995  end 
     1996   
    19831997end 
    19841998