search for: child_fields

Displaying 1 result from an estimated 1 matches for "child_fields".

2009 Oct 15
4
Getting the object in fields_for
I''m using the fields_for helper with accepts_nested_attributes_for The System model has_many children. If I do this in my haml template: -form_for @system do |s| =s.text_field :name -s.fields_for :children do |child_fields| =child_fields.text_field :name all is fine. The fields_for iterates over all children and puts the correct data in the fields. But...what I want to do is access the child object in that loop. With normal fields_for I could do: =child_fields.object.foo() within the loop, b...