newbie question: how to show a drop down menu with this function
- by Mellon
My model object (e.g. MyObject) has one property (e.g. color), the "color" property holds a string value which comes from a list of string (e.g. colors=['red','yellow', 'black']).
now, I have one instance of myObject get from database and show on the view page in a row, I need to show the 'color' property of myObject in a drop down menu with the current value as the default selected. How to implement this in Rails 3 in my view page.
(Later, when user select from the dropdown menu, the object will be updated in DB based on user's selection)
Please explain with instance "myObject" and list "colors=[...]"