On Tue, Apr 21, 2009 at 2:46 PM, mikej
<mikejeremiah-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> Sure this one is solved somewhere, but couldn''t find it.
>
> I have a table which has a related table (has many through). I wish
> to choose 1 or more items in the related table with a check box. For
> example, if I had a table with group one, group two and group three
> and a list of clients. I would like to have a form so that given a
> client, (in the edit client form), I can assign a client to one or
> more groups.
>
> How would I construct a form to achieve this using a reasonable
> succinct controller?
>
> Many thanks,
>
> Mike
Have a look at fields_for which you can use for linked models
http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M001573
There is also Nested Object Forms in Rails 2.3
http://guides.rubyonrails.org/2_3_release_notes.html#nested-object-forms
Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake
"I have never let my schooling interfere with my education" - Mark
Twain