instance method map_match

Ruby on Rails 5.0.7.2

Since v5.0.7.2 Private — implementation detail, not part of the public API

Available in: v5.0.7.2 v5.1.7 v5.2.8.1 v6.0.6.1 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3.2 v8.0.5.1 v8.1.3.1 edge

Signature

map_match(paths, options)

No documentation comment.

Parameters

paths req
options req
Source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 1887
        def map_match(paths, options)
          if options[:on] && !VALID_ON_OPTIONS.include?(options[:on])
            raise ArgumentError, "Unknown scope #{on.inspect} given to :on"
          end

          if @scope[:to]
            options[:to] ||= @scope[:to]
          end

          if @scope[:controller] && @scope[:action]
            options[:to] ||= "#{@scope[:controller]}##{@scope[:action]}"
          end

          controller = options.delete(:controller) || @scope[:controller]
          option_path = options.delete :path
          to = options.delete :to
          via = Mapping.check_via Array(options.delete(:via) {
            @scope[:via]
          })
          formatted = options.delete(:format) { @scope[:format] }
          anchor = options.delete(:anchor) { true }
          options_constraints = options.delete(:constraints) || {}

          path_types = paths.group_by(&:class)
          path_types.fetch(String, []).each do |_path|
            route_options = options.dup
            if _path && option_path
              ActiveSupport::Deprecation.warn <<-eowarn
Specifying strings for both :path and the route path is deprecated. Change things like this:

match #{_path.inspect}, :path => #{option_path.inspect}

to this:

match #{option_path.inspect}, :as => #{_path.inspect}, :action => #{_path.inspect}
              eowarn
              route_options[:action] = _path
              route_options[:as] = _path
              _path = option_path
            end
            to = get_to_from_path(_path, to, route_options[:action])
            decomposed_match(_path, controller, route_options, _path, to, via, formatted, anchor, options_constraints)
          end

          path_types.fetch(Symbol, []).each do |action|
            route_options = options.dup
            decomposed_match(action, controller, route_options, option_path, to, via, formatted, anchor, options_constraints)
          end

          self
        end

Defined in actionpack/lib/action_dispatch/routing/mapper.rb line 1887 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::Routing::Mapper::Resources

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close