Populating/updating values from select multiple


#1

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
@record.save 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:

<%= options_for_select(Table3.find_all.collect {|t3| [ t3.name, t3.id ] }, @t2.collect{|t2| t2.t3_id} ) %>

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

thanks for any help!
csn


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com