I am trying to use haml in a partial, I wrote:
%p.nested-check-fields
= f.input :is_correct
= link_to_remove_fields "remove choice", f
but, in the resulted HTML, I get
<p class="nested-check-fields"> </p>
<div class="input boolean optional">
<input type="hidden" value="0" name="quiz[quiz_choices_attributes][1320389712363][is_correct]">
<input id="quiz_quiz_choices_attributes_1320389712363_is_correct" class="boolean optional" type="checkbox" value="1" name="quiz[quiz_choices_attributes][1320389712363][is_correct]">
<label class="boolean optional" for="quiz_quiz_choices_attributes_1320389712363_is_correct"> Is correct</label>
</div>
The question is, why the <p class="nested-check-fields"> </p> is empty ?? I was expecting to wrap the div inside it, what’s wrong ??
Haml is very strict about indentation (from the documentation):
It sounds like you can actually use 4 spaces instead of 2, but that means you have to use 4 spaces everywhere (you can’t mix it). I’d recommend just sticking with 2-space indentation, as that’s the most common.