aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-06-28 21:18:04 +0000
committerJamis Buck <jamis@37signals.com>2005-06-28 21:18:04 +0000
commit453ed1539500f3dc9f704bb0933f50cc42bbe46a (patch)
treee78be3dd0139329509485f8b487c1a5016c5f301 /actionpack
parent5136c2a16b625f99df3e0255bb8eaf80161b5823 (diff)
downloadrails-453ed1539500f3dc9f704bb0933f50cc42bbe46a.tar.gz
rails-453ed1539500f3dc9f704bb0933f50cc42bbe46a.tar.bz2
rails-453ed1539500f3dc9f704bb0933f50cc42bbe46a.zip
Routes fail with leading slash #1540 [Nicholas Seckar]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1555 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_controller/routing.rb1
-rw-r--r--actionpack/test/controller/routing_test.rb5
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