instance method
_render_partial_with_options
Ruby on Rails 2.11.5
Since v2.4.1 Last seen in v2.14.1 PrivateSignature
_render_partial_with_options(options)
No documentation comment.
Parameters
-
optionsreq
Source
# File lib/jbuilder/jbuilder_template.rb, line 139
def _render_partial_with_options(options)
options.reverse_merge! locals: options.except(:partial, :as, :collection, :cached)
options.reverse_merge! ::JbuilderTemplate.template_lookup_options
as = options[:as]
if as && options.key?(:collection) && CollectionRenderer.supported?
collection = options.delete(:collection) || []
partial = options.delete(:partial)
options[:locals].merge!(json: self)
if options.has_key?(:layout)
raise ::NotImplementedError, "The `:layout' option is not supported in collection rendering."
end
if options.has_key?(:spacer_template)
raise ::NotImplementedError, "The `:spacer_template' option is not supported in collection rendering."
end
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?
elsif as && options.key?(:collection) && !CollectionRenderer.supported?
# For Rails <= 5.2:
as = as.to_sym
collection = options.delete(:collection)
locals = options.delete(:locals)
array! collection do |member|
member_locals = locals.clone
member_locals.merge! collection: collection
member_locals.merge! as => member
_render_partial options.merge(locals: member_locals)
end
else
_render_partial options
end
end
Defined in lib/jbuilder/jbuilder_template.rb line 139
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in JbuilderTemplate