Hi,
I’m trying to populate a drop-down list with objects and to set the
selected object.
<%= select_tag ‘list’,
options_from_collection_for_select(@menulist,“id”,“name”,
lamenu.menuelement_id.to_s) %>
lamenu(it has properties “name”,“id” ) is an element from a list
@menulist.
the output in html my list looks like
<select id=“list” name=“list”
…
I look in the html ant there’s no with the selected atribute.
For testing I printed lamenu.menuelement_id.to_s near the select box,
if i put that value explicitly in options_from_collection_for_select
example:
<%= select_tag ‘list’,
options_from_collection_for_select(@menulist,“id”,“name”, 20) %> , then
my selected element will be the one with the id 20 and not the first one
in the list.
There’s something missing but i don’t kow what…
Thanks.