Skip to content
Browse files

Fixed routing bug #1592

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1645 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 2082913 commit 5524dedc06b142c98c35fbd86b24f37bc10458b3 @dhh dhh committed Jul 3, 2005
Showing with 5 additions and 0 deletions.
  1. +2 −0 actionpack/lib/action_controller/routing.rb
  2. +3 −0 actionpack/test/controller/routing_test.rb
View
2 actionpack/lib/action_controller/routing.rb
@@ -360,10 +360,12 @@ def initialize
def generate(options, request_or_recall_hash = {})
recall = request_or_recall_hash.is_a?(Hash) ? request_or_recall_hash : request_or_recall_hash.symbolized_path_parameters
+ use_recall = true
controller = options[:controller]
recall_controller = recall[:controller]
if (recall_controller && recall_controller.include?(?/)) || (controller && controller.include?(?/))
+ recall = {} if controller && controller[0] == ?/
options[:controller] = Routing.controller_relative_to(controller, recall_controller)
end
options = recall.dup if options.empty? # XXX move to url_rewriter?
View
3 actionpack/test/controller/routing_test.rb
@@ -573,6 +573,9 @@ def test_default_setup
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'})
+
+ assert_equal ['/admin/stuff', {}], rs.generate({:controller => 'stuff'}, {:controller => 'admin/user', :action => 'list', :id => '10'})
+ assert_equal ['/stuff', {}], rs.generate({:controller => '/stuff'}, {:controller => 'admin/user', :action => 'list', :id => '10'})
end
def test_ignores_leading_slash

0 comments on commit 5524ded

Please sign in to comment.
Something went wrong with that request. Please try again.