Make namespace work with options[:to] [#4351 state:committed]
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
parent
6d29f9789e
commit
5b89fd07b2
@ -55,6 +55,14 @@ def extract_path_and_options(args)
|
||||
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)
|
||||
|
@ -140,7 +140,7 @@ def self.matches?(request)
|
||||
|
||||
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 @@ def test_namespaced_roots
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user