DamnBigMan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-20 15:29 UTC
Join Table confusion
I have a view in which I would like to set values for three separate
join tables. Everything seems to work fine from the console but when
I use the _form.rhtml it only inserts values into the first join
table.
This is what I have in my _form.rhtml
<p>
<label for="technicians">Technicians:</label><br
/>
<select id="technicians" name="technicians[]"
multiple="multiple"
size="5" style="width:250px;">
<%options_from_collection_for_select(@all_technicians, :id, :name,
@selected_technicians) %>
</select>
</p>
<p>
<label for="computers">Computer Models:</label><br
/>
<select id="computers" name="computers[]"
multiple="multiple"
size="3" style="width:150px;">
<%options_from_collection_for_select(@all_computers, :id, :model,
@selected_computers) %>
</select>
</p>
<p>
<label for="licensed_programs">Licensed
Software:</label><br />
<select id="licensed_programs"
name="licensed_programs[]"
multiple="multiple" size="8"
style="width:200px">
<%options_from_collection_for_select(@all_licensed_programs, :id, :name,
@selected_licensed_programs) %>
</select>
</p>
The html that is generated looks good too
<p>
<label for="technicians">Technicians:</label><br
/>
<select id="technicians" name="technicians[]"
multiple="multiple"
size="5" style="width:250px;">
<option value="4">Albert Martinez</option>
<option value="6">Chris Sanchez</option>
<option value="3">Luis Arvizu</option>
<option value="5">Orlando Garcia</option>
<option value="2">Richard Martinez</option>
<option value="1">Thao Dang</option>
</select>
</p>
<p>
<label for="computers">Computer Models:</label><br
/>
<select id="computers" name="computers[]"
multiple="multiple"
size="3" style="width:150px;">
<option value="1">Dell GX240</option>
</select>
</p>
<p>
<label for="licensed_programs">Licensed
Software:</label><br />
<select id="licensed_programs"
name="licensed_programs[]"
multiple="multiple" size="8"
style="width:200px">
<option value="1">VIZ</option>
</select>
</p>
I would guess I''m missing how/where it''s being passed to
ActiveRecord. Although technicians works and I have the subsequent
two constructed in a similar fashion.
Any help would be greatly appreciated.
Thanks,
Glen
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
use the select tag generator. <%= select :model, :technicians, @all_technitions %> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
DamnBigMan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Feb-20 17:37 UTC
Re: Join Table confusion
Thank, I appreciate the reply. I was being stupid though and had a couple of pieces missing in the controller. Will <%= select :model, :technicians, @all_technicians %> generate a multi-select? i.e. does it generate based on the relations defined in the model? On Feb 20, 10:20 am, Keynan Pratt <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> use the select tag generator. > > <%= select :model, :technicians, @all_technitions %> > > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---