Flowdock

Notes posted by mrbongiolo

RSS feed
August 9, 2010
2 thanks

When using enumerables

When using enumerables and storing them as strings in the database don’t forget to use .to_s or the select helper won’t automatically select your choice when viewing your data after save.

Exemple:

dates = 1900..Date.today.year
f.select(:year, dates.collect {|d| [d.to_s,d.to_s]}, {:include_blank => "Select"}, {:class => "some_class"} )