Forum: Ruby on Rails Populating/updating values from select multiple

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
CSN (Guest)
on 2005-12-11 21:36
(Received via mailing list)
I have an edit page that displays the main record, and
also values from one-to-many tables (displayed in
select multiple fields). What's the easiest way to
update these one-to-many values? Is there something
like '@record.table2.attributes=params[:table2]',
which will delete and save the table2 values when is called? I'm also not sure what I
should name my select fields -
'name="record[table2]"', 'name="table2"', etc. That
reminds me, is it possible to generate the select
fields in the first place by simply connecting them to
@record.table2? I'm currently doing this:

<select name="table2" multiple size=10>
<%= options_for_select(Table3.find_all.collect {|t3| [, ] }, @t2.collect{|t2| t2.t3_id} ) %>

table 3 is id|name
table 2 is record_id|table3_id

thanks for any help!

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
This topic is locked and can not be replied to.