i didn't understand that...
try to explain me some things... i would be pleased to help.

so, you want a ComboBox that shows what? the values in the array?
if it is so, you may want to populate this array in the controller, and
iterate it in the view, adding values for each item in your array.

imagine this:

I have an array of places, that i want to show in a ComboBox in the view.

so, in the controller you create an instance variable, thats your array, and
in the view, you`ll put pure HTML and iterate your array adding values

like:
<form>
 <select name="hour">
 <%...@my_array.each do |h| %>
  <option value="<%= h.value %>"><%= h.text %>
 <%end%>
 </select>
</form>

you understand what I mean?

by doing this, rails will use the injected ruby code to iterate trough your
form, and will repeat the same code for each item in the array, remember you
can work this out...


well... lets try to solve your problem...

lets say you have this array

@time = [[minute,min,20,50],[hour,hr,10,50]]

then in the view you'll iterate this array:


<form>
  <select>
    <% @time.each do |item| %>

    <option value="<%= item[1] %>"><%= item[0] %>

    <% end %>
  </select>
</form>

this way you'll have a ComboBox that shows whatever is in your array's
item's 0 index, with the value (what goes with the form) being whatever is
in you array's item's 1 index.


I hope I'm being helpful...


Lucas Franceschi
Equipe de Programação (Automação)
SGI Sistemas
(049) 9922-3360


On Tue, Aug 3, 2010 at 8:10 AM, Chad Weier <[email protected]> wrote:

>
> > How would I get a select box to list
> > -minute
> > -hour
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to