I have a form for an instance of a "project". Each project can have many clients. Each client is a unique pair of organization and individual (contact person).
So, Project has a many-to-many relationship with Client. Client has a many-to-one relationship with organization and a many-to-one relationship with Organization.
See an image of the model diagram: http://dl.dropbox.com/u/631919/erm.png
In the edit page for a project, I'd like to be able to change the organization for each client through a drop down select menu, but I'm having trouble getting the organizations to appear in the select input item.
Here's what I have:
<% form_for(@project) do |f| %>
<% @project.clients.each do |client| %>
<%= f.select("client.organization_id", Disclosure.all.collect {|d| [d.color.titlecase, d.id] }) %>
<% end %>
<% end %>
I know this is wrong, but I don't know how you get a select drop-down menu that I want, which is a select menu with the organization associated with each client as the default selection.
Any help?