Forum: Ruby on Rails Select Box population

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Mike (Guest)
on 2007-03-10 16:45
I would like to populate a select box in rails with the values 0 - 100 -
how can this be done in rails?
Mike (Guest)
on 2007-03-10 17:31
Mike wrote:
> I would like to populate a select box in rails with the values 0 - 100 -
> how can this be done in rails?

any ideas anyone?
macarthy (Guest)
on 2007-03-10 19:03
(Received via mailing list)
> > I would like to populate a select box in rails with the values 0 - 100 -
> > how can this be done in rails?
>
> any ideas anyone?

<% 1.upto(100) do |i| %>
 <option > <%= i %></option>
<% end %>

Justin
Eden L. (Guest)
on 2007-03-10 19:16
(Received via mailing list)
Also,

<%= select_tag("value", options_for_select((0..100).map { |v| [v.to_s,
v] })) %>
Mike (Guest)
on 2007-03-11 19:18
thanks a lot guys - very helpful!
This topic is locked and can not be replied to.