diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-05-30 11:36:12 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-06-03 11:33:51 -0700 |
commit | 496e25aab777c5ee5d02d08973125467f0a19cdc (patch) | |
tree | 74cecdf97b218750eb6baccc85f215f580d182a6 /actionpack | |
parent | e975b7d04e6497e3d3c8c23a174b79968a28efb7 (diff) | |
download | rails-496e25aab777c5ee5d02d08973125467f0a19cdc.tar.gz rails-496e25aab777c5ee5d02d08973125467f0a19cdc.tar.bz2 rails-496e25aab777c5ee5d02d08973125467f0a19cdc.zip |
disconnect options and scope from the `blocks` method
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 15 |
1 files 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 |