instance method
apply_common_behavior_for
Ruby on Rails 8.1.2
Since v3.0.20 PrivateSignature
apply_common_behavior_for(method, resources, shallow: nil, **options, &block)
No documentation comment.
Parameters
-
methodreq -
resourcesreq -
shallowkey = nil -
optionskeyrest -
blockblock
Source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 1928
def apply_common_behavior_for(method, resources, shallow: nil, **options, &block)
if resources.length > 1
resources.each { |r| public_send(method, r, shallow:, **options, &block) }
return true
end
if shallow
self.shallow do
public_send(method, resources.pop, **options, &block)
end
return true
end
if resource_scope?
nested { public_send(method, resources.pop, shallow:, **options, &block) }
return true
end
options.keys.each do |k|
(options[:constraints] ||= {})[k] = options.delete(k) if options[k].is_a?(Regexp)
end
scope_options = options.slice!(*RESOURCE_OPTIONS)
scope_options[:shallow] = shallow unless shallow.nil?
unless scope_options.empty?
scope(**scope_options) do
public_send(method, resources.pop, **options, &block)
end
return true
end
false
end
Defined in actionpack/lib/action_dispatch/routing/mapper.rb line 1928
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionDispatch::Routing::Mapper::Resources