I want to have a drop down that consists of values 10% 20% 30% so on till 100.
In ruby It can be done by
(10..100).step(10) { |i| p i }
how can i convert this into a select tag?
I tried:
<%=p.select :thc, options_for_select((10..100).step(10) {|s| ["#{s}%", s]})%>
but this is printing 10 11 12 13....100
You almost had it:
<%=p.select :thc, options_for_select((10..100).step(10).to_a.map{|s| ["#{s}%", s]})%>
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