In my rails form I'm using the select tag.
<%= f.select :featured,
Timeline::TIMELINE_FEATURED,
:prompt => "Select" %>
The definition of TIMELINE_FEATURES is Yes and No to be displayed, but stored as INT in database:
TIMELINE_FEATURED = [
# Displayed stored in db
["No", "0"],
["Yes", "1"]
]
My problem is that when I go to the edit page the dropdown value is NOT selected correctly.
For example, if I had set the dropdown to Yes, and store the value of 1 in the database if I come back to this dropdown Yes is NOT selected like it should be. Is it because the value is stored as an Integer in DB but it's a string in the option tag? How do I solve?
I have other selects in the same form that are working correctly but the value stored in the DB is a string.
Thank you in advance.