instance method _render_partial_with_options

Ruby on Rails 2.14.1

Since v2.4.1 Last seen in v2.14.1 Private

Available in: v2.4.1 v2.5.0 v2.6.4 v2.7.0 v2.8.0 v2.9.1 v2.10.2 v2.11.5 v2.12.0 v2.13.0 v2.14.1

Signature

_render_partial_with_options(options)

No documentation comment.

Parameters

options req
Source
# File lib/jbuilder/jbuilder_template.rb, line 148
  def _render_partial_with_options(options)
    options[:locals] ||= options.except(:partial, :as, :collection, :cached)
    options[:handlers] ||= ::JbuilderTemplate.template_lookup_options[:handlers]
    as = options[:as]

    if as && options.key?(:collection)
      collection = options.delete(:collection) || []
      partial = options.delete(:partial)
      options[:locals][:json] = self
      collection = EnumerableCompat.new(collection) if collection.respond_to?(:count) && !collection.respond_to?(:size)

      if options.has_key?(:layout)
        ::Kernel.raise ::NotImplementedError, "The `:layout' option is not supported in collection rendering."
      end

      if options.has_key?(:spacer_template)
        ::Kernel.raise ::NotImplementedError, "The `:spacer_template' option is not supported in collection rendering."
      end

      if collection.present?
        results = CollectionRenderer
          .new(@context.lookup_context, options) { |&block| _scope(&block) }
          .render_collection_with_partial(collection, partial, @context, nil)

        array! if results.respond_to?(:body) && results.body.nil?
      else
        array!
      end
    else
      _render_partial options
    end
  end

Defined in lib/jbuilder/jbuilder_template.rb line 148 · View on GitHub · Improve this page · Find usages on GitHub

Defined in JbuilderTemplate

Type at least 2 characters to search.

↑↓ navigate · open · esc close