method

render_collection

Importance_0
v6.1.3.1 - Show latest stable - 0 notes - Class: CollectionRenderer
render_collection(collection, view, path, template, layout, block) private

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File actionview/lib/action_view/renderer/collection_renderer.rb, line 145
      def render_collection(collection, view, path, template, layout, block)
        identifier = (template && template.identifier) || path
        ActiveSupport::Notifications.instrument(
          "render_collection.action_view",
          identifier: identifier,
          layout: layout && layout.virtual_path,
          count: collection.length
        ) do |payload|
          spacer = if @options.key?(:spacer_template)
            spacer_template = find_template(@options[:spacer_template], @locals.keys)
            build_rendered_template(spacer_template.render(view, @locals), spacer_template)
          else
            RenderedTemplate::EMPTY_SPACER
          end

          collection_body = if template
            cache_collection_render(payload, view, template, collection) do |filtered_collection|
              collection_with_template(view, template, layout, filtered_collection)
            end
          else
            collection_with_template(view, nil, layout, collection)
          end

          return RenderedCollection.empty(@lookup_context.formats.first) if collection_body.empty?

          build_rendered_collection(collection_body, spacer)
        end
      end
Register or log in to add new notes.