diff options
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/routing.rb | 1 | ||||
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 5 |
3 files changed, 8 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index f124a935c0..b3e1425843 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Routes fail with leading slash #1540 [Nicholas Seckar] + * Added support for upload progress indicators in Apache and lighttpd 1.4.x (won't work in WEBrick or lighttpd 1.3.x) #1475 [Sean Treadway] See http://sean.treadway.info/files/howto-upload-progress-2.mov for example. diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index 998faf356f..5499cd2545 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -320,6 +320,7 @@ module ActionController def initialize_components(path) path = path.split('/') if path.is_a? String + path.shift if path.first.blank? self.components = path.collect {|str| Component.new str} end diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 60481ec9d0..d7b10f69d9 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -574,6 +574,11 @@ class RouteSetTests < Test::Unit::TestCase assert_equal ['admin/user/show', {}], rs.generate({:action => 'show'}, {:controller => 'admin/user', :action => 'list', :id => '10'}) assert_equal ['admin/user/list/10', {}], rs.generate({}, {:controller => 'admin/user', :action => 'list', :id => '10'}) end + + def test_ignores_leading_slash + @rs.draw {|m| m.connect '/:controller/:action/:id'} + test_default_setup + end def test_time_recognition n = 10000 |