Skip to content

Commit

Permalink
Merge pull request ViewComponent#317 from rainerborene/bug/compilation
Browse files Browse the repository at this point in the history
Compile component before rendering collection
  • Loading branch information
joelhawksley authored Apr 21, 2020
2 parents b6dd985 + 8b7b963 commit 0aa5790
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# master

# 2.5.1

* Compile component before rendering collection.

Rainer Borene

# v2.5.0

* Add counter variables when rendering collections.
Expand Down
1 change: 1 addition & 0 deletions lib/view_component/collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Collection
def render_in(view_context, &block)
iterator = ActionView::PartialIteration.new(@collection.size)

@component.compile!
@collection.map do |item|
content = @component.new(component_options(item, iterator)).render_in(view_context, &block)
iterator.iterate!
Expand Down

0 comments on commit 0aa5790

Please sign in to comment.