instance method map_match

Ruby on Rails 8.1.2

Since v5.2.8.1 Private

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

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)

No documentation comment.

Parameters

path_or_action req
constraints key = nil
anchor key = nil
format key = nil
path key = nil
as key = DEFAULT
via key = nil
to key = nil
controller key = nil
action key = nil
on key = nil
internal key = nil
mapping key = nil
Source
# 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

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

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

Type at least 2 characters to search.

↑↓ navigate · open · esc close