views:

53

answers:

1

In my item table, I have a itemname column which is currently a dropdown list taking values from DB.

<%= select 'item','itemname',
   Item.find(:all).collect{|c| [c.itemname]},{:include_blank => 'Select Name'} %>

How can I add a new value to this dropdown list through the application. Is there a provision to directly add value to the list?

Thanks

+1  A: 

Do the following:

<%= select 'item','itemname',
   Item.find(:all).collect{|c| [c.itemname]}.concat(["Foo Item", "Bar Item"]),
   {:include_blank => 'Select Name'} %>
KandadaBoggu