Closed
Description
Hi!
I'm playing with this project for use in production but I encountered a possible bug related with passing a Slim/HTML block to Rails helper.
# app/components/test_component.rb
class TestComponent < ActionView::Component::Base
def initialize(form:)
@form = form
end
attr_reader :form
end
/ app/components/test_component.html.slim
div
= form.text_field :name
= form.label :name do
div.label__text
| Nombre
/ app/views/tests/show.html.slim
= form_with model: @test do |form|
/! Test Component Start
= render TestComponent.new(form: form)
/! Test Component End
Expected output:
<!-- Test Component Start -->
<div>
<input type="text" name="test[name]" id="test_name">
<label for="test_name">
<div class="label__text">Nombre</div>
</label>
</div>
<!-- Test Component End -->
Current output:
<!-- Test Component Start -->
<div>
<input type="text" name="test[name]" id="test_name">
<div class="label__text">Nombre</div>
<label for="test_name">
<div>
<input type="text" name="test[name]" id="test_name">
<div class="label__text">Nombre</div>
</div><!-- Test Component End -->
</label>
</div>
In normal Rails the block of code passed to the helper works perfectly. Any ideas? Thanks!
Metadata
Metadata
Assignees
Labels
No labels