instance method apply_common_behavior_for

Ruby on Rails 7.0.10

Since v3.0.20 Private

Available in: v3.0.20 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

apply_common_behavior_for(method, resources, options, &block)

No documentation comment.

Parameters

method req
resources req
options req
block block
Source
# File actionpack/lib/action_dispatch/routing/mapper.rb, line 1704
          def apply_common_behavior_for(method, resources, options, &block)
            if resources.length > 1
              resources.each { |r| public_send(method, r, options, &block) }
              return true
            end

            if options[:shallow]
              options.delete(:shallow)
              shallow do
                public_send(method, resources.pop, options, &block)
              end
              return true
            end

            if resource_scope?
              nested { public_send(method, resources.pop, 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)
            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 1704 · 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