Skip to content

Wrap a slot in a block #2062

Closed Answered by joelhawksley
jasonbouffard asked this question in Q&A

You must be logged in to vote

@jasonbouffard forgive me if I'm misunderstanding your question, but I believe that you need to treat the with_row call as simply a setter. Here is how I would do it:

<% form_with url: "/" do |form| %>
  <%= render ListComponent.new(form: form) do |component| %>
    <% component.with_header do %>
      Hi Everybody!
    <% end %>
    
    <% [1, 2, 3].each do |i|  %>
      <% component.with_row do %>
        <%= render partial: "partial", local_variables: {item: i, form: form} %>
      <% end %>
    <% end %>
  <% end %>
<% end %>

Replies: 1 comment

You must be logged in to vote
0 replies
Answer selected by joelhawksley
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants