mirror of
https://github.com/github/rails.git
synced 2026-04-04 03:00:58 -04:00
Fixed routing bug #1592
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1645 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user