From 496e25aab777c5ee5d02d08973125467f0a19cdc Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Fri, 30 May 2014 11:36:12 -0700 Subject: disconnect options and scope from the `blocks` method --- actionpack/lib/action_dispatch/routing/mapper.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 1b944fb308..d6d42413a3 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -79,6 +79,7 @@ module ActionDispatch formatted = options.delete :format via = Array(options.delete(:via) { [] }) + @blocks = blocks(options[:constraints], scope[:blocks]) path = normalize_path! path, formatted ast = path_ast path @@ -87,14 +88,14 @@ module ActionDispatch constraints = constraints(options[:constraints], scope[:constraints]) - normalize_requirements!(path_params, formatted, constraints) + normalize_requirements!(path_params, formatted, constraints) normalize_conditions!(path_params, path, ast, via, constraints) normalize_defaults!(formatted) end def to_route - [ app, conditions, requirements, defaults, as, anchor ] + [ app(@blocks), conditions, requirements, defaults, as, anchor ] end private @@ -232,7 +233,7 @@ module ActionDispatch end end - def app + def app(blocks) return to if Redirect === to if to.respond_to?(:call) @@ -303,11 +304,11 @@ module ActionDispatch yield end - def blocks - if options[:constraints].present? && !options[:constraints].is_a?(Hash) - [options[:constraints]] + def blocks(options_constraints, scope_blocks) + if options_constraints.present? && !options_constraints.is_a?(Hash) + [options_constraints] else - scope[:blocks] || [] + scope_blocks || [] end end -- cgit v1.2.3