instance method
collection_with_template
Ruby on Rails 3.0.20
Since v3.0.20 Last seen in v3.0.20Signature
collection_with_template(template = @template)
No documentation comment.
Parameters
-
templateopt = @template
Source
# File actionpack/lib/action_view/render/partials.rb, line 284
def collection_with_template(template = @template)
segments, locals, template = [], @locals, @template
if @options[:as]
as = @options[:as]
counter = "#{as}_counter".to_sym
else
as = template.variable_name
counter = template.counter_name
end
locals[counter] = -1
@collection.each do |object|
locals[counter] += 1
locals[as] = object
segments << template.render(@view, locals)
end
segments
end
Defined in actionpack/lib/action_view/render/partials.rb line 284
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Partials::PartialRenderer