I have a review model that allows you to use the "1-10" system for products. In my view of the form, here is how I made the field to spit out the dropdown menu 1-10 ...
<%= f.select :rating, options_for_select((0..10).to_a, @review.rating) %>
Works great, but the team now wants to have .5 decimal numbers for the rating system, so something can be rated 7.5, 8.0, 8.5, etc.
However, this puzzled me ... how can I change the code above and iterate over a set of numbers and increment it by .5 every time in Ruby? (Note. Yes, I already converted my rating column from integer to float.)
source share