diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_controller/routing.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/url_rewriter.rb | 4 | ||||
-rw-r--r-- | actionpack/test/controller/routing_tests.rb | 16 |
3 files changed, 10 insertions, 12 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index acdb4635f0..18645ae4e0 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -74,8 +74,6 @@ module ActionController end components.collect! {|c| c.to_s} - components.unshift(components.shift + '/') if components.length == 1 && @items.first == :controller # Add '/' to controllers - return components, unused end diff --git a/actionpack/lib/action_controller/url_rewriter.rb b/actionpack/lib/action_controller/url_rewriter.rb index a1b1a2a57b..45263f40fe 100644 --- a/actionpack/lib/action_controller/url_rewriter.rb +++ b/actionpack/lib/action_controller/url_rewriter.rb @@ -42,7 +42,7 @@ module ActionController RESERVED_OPTIONS.each {|k| options.delete k} path, extras = Routing::Routes.generate(options, @request) - path = "/#{path.join('/')}" + path = "/#{path.join('/')}".chomp '/' path += build_query_string(extras) return path @@ -135,4 +135,4 @@ module ActionController return query_string end end -end
\ No newline at end of file +end diff --git a/actionpack/test/controller/routing_tests.rb b/actionpack/test/controller/routing_tests.rb index 5b3879f3b1..69fe6e2b2a 100644 --- a/actionpack/test/controller/routing_tests.rb +++ b/actionpack/test/controller/routing_tests.rb @@ -137,12 +137,12 @@ class RouteTests < Test::Unit::TestCase verify_recognize('admin/user', {:controller => 'admin/user', :action => 'index'}) end def test_generate_default_nested_no_extras - verify_generate('admin/user/', {}, {:controller => 'admin/user'}, @defaults) - verify_generate('admin/user/', {}, {:controller => 'admin/user'}, @defaults) + verify_generate('admin/user', {}, {:controller => 'admin/user'}, @defaults) + verify_generate('admin/user', {}, {:controller => 'admin/user'}, @defaults) end def test_generate_default_nested - verify_generate('admin/user/', {:a => 'a'}, {:controller => 'admin/user', :a => 'a'}, @defaults) - verify_generate('admin/user/', {:a => 'a'}, {:controller => 'admin/user', :a => 'a'}, @defaults) + verify_generate('admin/user', {:a => 'a'}, {:controller => 'admin/user', :a => 'a'}, @defaults) + verify_generate('admin/user', {:a => 'a'}, {:controller => 'admin/user', :a => 'a'}, @defaults) end # Test generate with a default controller set. @@ -429,16 +429,16 @@ class RouteSetTests < Test::Unit::TestCase end def test_generate_typical_controller_index_path_explicit_index typical_request - verify_generate('content/', {:controller => 'content', :action => 'index'}) + verify_generate('content', {:controller => 'content', :action => 'index'}) end def test_generate_typical_controller_index_path_explicit_index typical_request - verify_generate('content/', {:controller => 'content', :action => 'index'}) + verify_generate('content', {:controller => 'content', :action => 'index'}) end def test_generate_typical_controller_index_path_implicit_index typical_request @request.path_parameters[:controller] = 'resource' - verify_generate('content/', {:controller => 'content'}) + verify_generate('content', {:controller => 'content'}) end def test_generate_no_perfect_route @@ -480,6 +480,6 @@ end class AssertionRoutingTests < Test::Unit::TestCase def test_assert_routing ActionController::Routing::Routes.reload rescue nil - assert_routing('content/', {:controller => 'content', :action => 'index'}) + assert_routing('content', {:controller => 'content', :action => 'index'}) end end |