I am trying to have multiple blocks of choice. select will contain all the stores in the database, but those that belong to the user will be selected.
I'm halfway there. I have a selection box that has all the stores in the database. I cannot select those to which the user belongs.
I have the following:
<%= select_tag 'stores[]', options_for_select(@stores.map {|s| [s.store_name, s.store_id]}, :selected => @user.stores.map {|j| [j.store_name, j.store_id]}), :multiple => true, :size => 10 %>
I have a map with stores to which the user belongs. he is in:
@user.stores
ruby-on-rails
Omnipresent Feb 03 '10 at 23:48 2010-02-03 23:48
source share