From 8b7b96314a66e8a8a97ef38d25873f91426335c5 Mon Sep 17 00:00:00 2001 From: Rainer Borene Date: Tue, 21 Apr 2020 14:50:40 -0300 Subject: [PATCH] fix(collection): make sure to compile component before rendering --- CHANGELOG.md | 6 ++++++ lib/view_component/collection.rb | 1 + 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 681321de7..8305fb783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # master +# 2.5.1 + +* Compile component before rendering collection. + + Rainer Borene + # v2.5.0 * Add counter variables when rendering collections. diff --git a/lib/view_component/collection.rb b/lib/view_component/collection.rb index 71dc13fa4..ce10969f1 100644 --- a/lib/view_component/collection.rb +++ b/lib/view_component/collection.rb @@ -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!