Class: ViewComponent::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/view_component/collection.rb

Instance Method Summary collapse

Instance Method Details

#render_in(view_context, &block) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/view_component/collection.rb', line 6

def render_in(view_context, &block)
  as = @component.collection_parameter_name

  @collection.map do |item|
    @component.new(@options.merge(as => item)).render_in(view_context, &block)
  end.join.html_safe
end