method

map_match

map_match(path_or_action, constraints: nil, anchor: nil, format: nil, path: nil, as: DEFAULT, via: nil, to: nil, controller: nil, action: nil, on: nil, internal: nil, mapping: nil)
private

No documentation available.

# File actionpack/lib/action_dispatch/routing/mapper.rb, line 2131
          def map_match(path_or_action, constraints: nil, anchor: nil, format: nil, path: nil, as: DEFAULT, via: nil, to: nil, controller: nil, action: nil, on: nil, internal: nil, mapping: nil)
            if on && !VALID_ON_OPTIONS.include?(on)
              raise ArgumentError, "Unknown scope #{on.inspect} given to :on"
            end

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

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

            controller ||= @scope[:controller]
            via = Mapping.check_via Array(via || @scope[:via])
            format ||= @scope[:format] if format.nil?
            anchor ||= true if anchor.nil?
            constraints ||= {}

            case path_or_action
            when String
              if path_or_action && path
                raise ArgumentError, "Ambiguous route definition. Both :path and the route path were specified as strings."
              end
              path = path_or_action
              to = get_to_from_path(path_or_action, to, action)
              decomposed_match(path, controller, as, action, path, to, via, format, anchor, constraints, internal, mapping, on)
            when Symbol
              decomposed_match(path_or_action, controller, as, action, path, to, via, format, anchor, constraints, internal, mapping, on)
            end

            self
          end