Permalink
Browse files

only look up scope[:module] once

  • Loading branch information...
1 parent 43d2105 commit 03de3a02c7feb523de437d1f33a3629fc3775a27 @tenderlove tenderlove committed May 30, 2014
Showing with 6 additions and 6 deletions.
  1. +6 −6 actionpack/lib/action_dispatch/routing/mapper.rb
@@ -87,7 +87,7 @@ def initialize(scope, path, options)
path = normalize_path! path, formatted
ast = path_ast path
path_params = path_params ast
- @options = normalize_options!(options, formatted, path_params, ast)
+ @options = normalize_options!(options, formatted, path_params, ast, scope[:module])
constraints = constraints(options_constraints, scope[:constraints])
@@ -119,7 +119,7 @@ def optional_format?(path, format)
format != false && !path.include?(':format') && !path.end_with?('/')
end
- def normalize_options!(options, formatted, path_params, path_ast)
+ def normalize_options!(options, formatted, path_params, path_ast, modyoule)
# Add a constraint for wildcard route to make it non-greedy and match the
# optional format part of the route by default
if formatted != false
@@ -129,7 +129,7 @@ def normalize_options!(options, formatted, path_params, path_ast)
end
if path_params.include?(:controller)
- raise ArgumentError, ":controller segment is not allowed within a namespace block" if scope[:module]
+ raise ArgumentError, ":controller segment is not allowed within a namespace block" if modyoule
# Add a default constraint for :controller path segments that matches namespaced
# controllers with default routes like :controller/:action/:id(.:format), e.g:
@@ -141,7 +141,7 @@ def normalize_options!(options, formatted, path_params, path_ast)
if to.respond_to? :call
options
else
- options.merge!(default_controller_and_action(path_params))
+ options.merge!(default_controller_and_action(path_params, modyoule))
end
end
@@ -247,11 +247,11 @@ def app(blocks)
end
end
- def default_controller_and_action(path_params)
+ def default_controller_and_action(path_params, modyoule)
controller, action = get_controller_and_action(default_controller,
default_action,
to,
- @scope[:module]
+ modyoule
)
hash = check_part(:controller, controller, path_params, {}) do |part|

0 comments on commit 03de3a0

Please sign in to comment.