Make namespace work with options[:to] [#4351 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
Santiago Pastorino
2010-04-11 04:39:25 -03:00
committed by José Valim
parent 6d29f9789e
commit 5b89fd07b2
2 changed files with 10 additions and 2 deletions

View File

@@ -55,6 +55,14 @@ module ActionDispatch
path = args.first
end
if @scope[:module] && options[:to]
if options[:to].to_s.include?("#")
options[:to] = "#{@scope[:module]}/#{options[:to]}"
elsif @scope[:controller].nil?
options[:to] = "#{@scope[:module]}##{options[:to]}"
end
end
path = normalize_path(path)
if using_match_shorthand?(path, options)

View File

@@ -140,7 +140,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
namespace :account do
match 'shorthand'
match 'description', :to => "account#description", :as => "description"
match 'description', :to => "description", :as => "description"
resource :subscription, :credit, :credit_card
root :to => "account#index"
@@ -864,7 +864,7 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
with_test_routes do
assert_equal '/account', account_root_path
get '/account'
assert_equal 'account#index', @response.body
assert_equal 'account/account#index', @response.body
end
end