yachtman
2007-Nov-20 14:54 UTC
{HTML options} in collection_select that show pre-selected options?
Seeking rails help.... On a form that is being edited (data is pre-filled), I am trying to show a collection_select with already selected options that are drawn from my database. I think that my code is nearly correct, but I just can''t seem to ''bind'' the instance variable to the list: *** VIEW *** <%= collection_select( :tag, :name, @tags, :id, :name, {}, :selected => @tags_selected, :multiple => true, :size =>5) %> *** CONTROLLER *** @tags_selected = EntryTag.find(:all, :conditions => "entry_id #{params[:id]}") My form comes up fine with all of the other data, as well as the items in the collection_select, but there is nothing pre-selected (there should be three items selected). Thanks in advance! yachtman --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---