Use a loop instead of with_collection to render questions

This is what we usually do in components.
This commit is contained in:
taitus
2025-08-20 09:37:45 +02:00
parent 83b206f0b7
commit 5944bb85c5
2 changed files with 4 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
class Polls::Results::QuestionComponent < ApplicationComponent
attr_reader :question
def initialize(question:)
def initialize(question)
@question = question
end

View File

@@ -16,7 +16,9 @@
</div>
<div>
<%= render Polls::Results::QuestionComponent.with_collection(poll.questions) %>
<% poll.questions.each do |question| %>
<%= render Polls::Results::QuestionComponent.new(question) %>
<% end %>
</div>
</div>
</div>