aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-07-03 12:01:06 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-07-03 12:01:06 +0000
commit5524dedc06b142c98c35fbd86b24f37bc10458b3 (patch)
tree22785dc504339a568b6d61ccbf274adfefee7974 /actionpack
parent208291391cdb34d4893ab3e32312edbe2b180095 (diff)
downloadrails-5524dedc06b142c98c35fbd86b24f37bc10458b3.tar.gz
rails-5524dedc06b142c98c35fbd86b24f37bc10458b3.tar.bz2
rails-5524dedc06b142c98c35fbd86b24f37bc10458b3.zip
Fixed routing bug #1592
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1645 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/routing.rb2
-rw-r--r--actionpack/test/controller/routing_test.rb3
2 files changed, 5 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb
index f2e7df6d6d..3771d3fead 100644
--- a/actionpack/lib/action_controller/routing.rb
+++ b/actionpack/lib/action_controller/routing.rb
@@ -360,10 +360,12 @@ module ActionController
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?
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index f5149c84bc..55cf5d8e94 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -573,6 +573,9 @@ 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'})
+
+ 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