diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_dispatch/routing/mapper.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index bf35a2b960..6e1db3b492 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -62,7 +62,7 @@ module ActionDispatch attr_reader :to, :default_controller, :default_action, :as, :anchor def self.build(scope, set, path, as, controller, default_action, to, via, options) - formatted = options.delete(:format) { scope[:options] && scope[:options][:format] } + formatted = options.delete(:format) { scope.mapping_option(:format) } options = scope[:options].merge(options) if scope[:options] @@ -1543,7 +1543,7 @@ module ActionDispatch option_path = options.delete :path to = options.delete :to via = Mapping.check_via Array(options.delete(:via) { - (@scope[:options] || {})[:via] + @scope.mapping_option(:via) }) path_types = paths.group_by(&:class) @@ -1990,6 +1990,12 @@ module ActionDispatch OPTIONS end + def mapping_option(name) + options = self[:options] + return unless options + options[name] + end + def new(hash) self.class.new hash, self, scope_level end |