Forms with nested objects

Hi,

I’m having a problem trying to create a form that can populated nested
objects. In my main object, WG, I have two lists of objects: A objects,
and
B objects. I want to display a form where I can select an arbitrary
number
of A objects with checkboxes, and a single B object with radio buttons.
The
problem is that when I try to do a form for the WG object, I get hungup
on
what attributes to use in w.check_box(). I’ve added a “selected”
attribute
to the A and B objects and was thinking I could use that, but when I do
something like:

form_for(:wg) do |w|
w.a_list.each do |a|
w.check_box(, {}, true,
false)
end
end

I keep hitting nil objects and syntax errors.

Any ideas? Did I explain myself clear enough?

Thanks,
Ryan

form_for(:wg) do |w|
w.a_list.each do |a|
w.check_box(, {}, true,
false)
end
end

I keep hitting nil objects and syntax errors.

Any ideas? Did I explain myself clear enough?

use field_for for the separate a & b objects then in the controller add
them to each of their association collections of the wg object

That looks right. I searched around for field_for which appears to be a
typo. I found fields_for, and an explanation of similar to what I’m
trying
to do here:

http://railsforum.com/viewtopic.php?id=719

Thanks