I would like to use a single form to display multiple existing associations and to permit additions to those that already exist. In its simplest form a row in U has an association to a row R through a row in C.
Now, in my case both R and U must exist before they may be associated and neither may be created in the same process that creates the association row in C. Further, the association in C contains data unique to that association. In the us_controller I can either use @u.r.build or I can use @u.c.build to create an empty new association for ActionView. However, if I go with @u.c.build instead of @u.r.build then I will end up with a nil object from the c.r_id field which will lead to errors in the view. If I choose to use @u.r.build then I will avoid the nil object error but of necessity I will also create new instances of R, which I most definitely do not want to do. I have looked at the railscasts on complex forms and I have purchased and viewed the advanced forms screencasts from the Pragmatic Programmers. I can see what is done there but I cannot seem to map what I have seen to what I want to accomplish. In the form I want to do a dynamic lookup on R by name and use the Iid of the selected R for the C association. But I cannot get the form to display the selectbox for R because for new records, unless an r instance is built along with c then the c.r_id value is null and that is an error. SO, how is this done? I imagine that someone who wants to add products to an order would not wish to allow order entry clerks to add products on the fly, so what is the technique that is used to add multiple associations between a single U and multiple R's on one form and at the same time does not allow instances of R to be created? Sincerely, -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

