This is a Rails 3 application with HAML.
I have the following:
= f.fields_for :bar_memberships do |bar_membership_fields|
= 'FIELD'
I have encapsulated the problem. This code prints:
FIELD
FIELD
FIELD
as expected.
But the following code:
= f.fields_for :bar_memberships do |bar_membership_fields|
- if bar_membership_fields.object.new_record?
= 'FIELD'
Renders a lot of HTML-escaped hidden inputs in the source code, and displays them on the page!
'<input id="person_bar_memberships_attributes_0_id" name="person[bar_memberships_attributes][0][id]" type="hidden" value="824" />
<input id="person_bar_memberships_attributes_1_id" name="person[bar_memberships_attributes][1][id]" type="hidden" value="825" />'
FIELD
Any idea?
I fixed the following code:
By doing:
If anyone knows why please let me know.