1
<%= f.select :something, 1.upto(10) do |i| i end %>
Refactorings
No refactoring yet !
Kai Chen
April 2, 2009, April 02, 2009 11:10, permalink
View
1
<%= f.select :something, (1..10).map(&:what) %>
perplexes.myopenid.com
April 2, 2009, April 02, 2009 16:38, permalink
1
<%= f.select :something, (1..10).to_a %>, or as Kai Chen responded. See the Ruby Range class (http://ruby-doc.org/core/classes/Range.html).
Kendall
April 3, 2009, April 03, 2009 21:01, permalink
Hello. That's very nice site but I've seen this before here <a href="http://href.inguaro.com/b6f500e9b5ff1ca84f24e3b7c91c0ea6">http://text.inguaro.com/b6f500e9b5ff1ca84f24e3b7c91c0ea6</a>
b6f500e9b5ff1ca84f24e3b7c91c0ea6
1 2
Hello. That's very nice site but I've seen this before here <a href="http://href.inguaro.com/b6f500e9b5ff1ca84f24e3b7c91c0ea6">http://text.inguaro.com/b6f500e9b5ff1ca84f24e3b7c91c0ea6</a> b6f500e9b5ff1ca84f24e3b7c91c0ea6
Trystan
April 3, 2009, April 03, 2009 21:01, permalink
The night of the fight, you may feel a slight sting. That's pride f*cking with you. F*ck pride. Pride only hurts, it never helps.
b6f500e9b5ff1ca84f24e3b7c91c0ea6
1 2
The night of the fight, you may feel a slight sting. That's pride f*cking with you. F*ck pride. Pride only hurts, it never helps. b6f500e9b5ff1ca84f24e3b7c91c0ea6
I find myself doing this a lot for drop down boxes:
<%= f.select :something, 1.upto(10) do |i| i end %>
I'm thinking it would be better to do something like:
<%= f.select :something, 1.upto(10).map(&:what) %>
...But the syntax is wrong and I can't get it to work right. The top method works fine, I was trying to be ace. Anyone do something similar or better?