instance method
map_match
Ruby on Rails 8.1.2
Since v5.2.8.1 PrivateSignature
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_actionreq -
constraintskey = nil -
anchorkey = nil -
formatkey = nil -
pathkey = nil -
askey = DEFAULT -
viakey = nil -
tokey = nil -
controllerkey = nil -
actionkey = nil -
onkey = nil -
internalkey = nil -
mappingkey = 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