Hello there,
I have the following models
class Bibliography < ActiveRecord::Base has_and_belongs_to_many :gthemes, :join_table => "gthemes_bibliographies" end
class Gtheme < ActiveRecord::Base has_and_belongs_to_many :bibliographies, :join_table => "gthemes_bibliographies" end
I want to include in the bibliography edit page a select box with all the gthemes and i want the members of @bibliography.gthemes to be marked as selected
I 'm using this in bibliography/_form.rhtml:
<%= select('bibliography', 'gthemes' , Gtheme.find(:all).collect{ |gt| [ gt.name, gt.id]}, {}, {:multiple => true}) %>
but it doesn't mark the current gthemes as selected, any ideas?
Thanks in advance, Christos