Displaying 1 result from an estimated 1 matches for "typecategory".
2006 Feb 28
6
Problem with select and each_with_index
...I was going so well. Wanted to produce a select box from an
array constant, with the indices returned as values , and the array
values used as the descriptions. Checked out Ruby RDoc and saw there was
an each_with_index method and came up with:
<%= select (''type'', ''typecategory'', Typecategory.each_with_index {|item,
index| [item, index]} )%>
Where typecategory is defined (in environment.rb) as [ ''A'', ''B'', ''C'',
''D'' ].
What I get out is:
<select id="type_typecategory" name=...