What is the simplest way to write a rails select tag that will generate a select for the numbers 1-15 stepped in .5 increments?
I know this has to be simple but i'm struggling with the syntax, i know there has to be a more elegant way to write it than how i did.
thanks!
select_tag "sizes", options_for_select((4..15).step(0.5))
This is how i wrote it... but is this the best way to approach?
also, if i wanted the 4.0/5.0/6.0 etc to read 4/5/6 as whole numbers, is there a way to do/include this on one line?
select_tag "sizes", options_for_select( (4..15).step(0.5).map{|n| n%1 == 0 ? n.to_i : n} )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With