A handy one this, for selections that aren't driven from the DB, but which have a value stored in a DB - and yes, I know that is not good practice ...
<%= f.label :number_colours %>
<%= f.select(:number_colours, options_for_select([ ["CMYK", 4], ["Black & white", 1], ["2 colour", 2], ["3 colour", 3], ["CMYK + special", 5] ], :selected=>@page_assembly.number_colours )) %>
the final :selected=> tag allows you to specify which one gets the lucky selected tag...
Thursday, 3 December 2009
Subscribe to:
Posts (Atom)