<p>
<b>Product</b><br />
<select name="repair_ticket[product_id]">
<% @products.each do |product| %>
<option value="<%= product.id %>"
<%= ' selected' if product.id == @repair_ticket.product_id %>>
<%= product.name%>
</option>
<% end %>
</select></p>
I have many products, so when I click to show my products and then
select one, I obtain a huge list. I would like only to show 5 or more of
my list and then have a sidebar in this list so I can roll down the
list and select one.
<p>
<b>Product</b><br />
<select name="repair_ticket[product_id]">
<% @products.each do |product| %>
<option value="<%= product.id %>"
<%= ' selected' if product.id == @repair_ticket.product_id %>>
<%= product.name%>
</option>
<% end %>
</select></p>
I have many products, so when I click to show my products and then
select one, I obtain a huge list. I would like only to show 5 or more of
my list and then have a sidebar in this list so I can roll down the
list and select one.
Well this should be easy to do.
option 1) do a limit on your find operation:
@products = Product.find(:all, :limit => 5)
or option 2) simply grab the first 5 from the array
<p>
<b>Product</b><br />
<select name="repair_ticket[product_id]">
<% @products.each do |product| %>
<option value="<%= product.id %>"
<%= ' selected' if product.id == @repair_ticket.product_id %>>
<%= product.name%>
</option>
<% end %>
</select></p>
I have many products, so when I click to show my products and then
select one, I obtain a huge list. I would like only to show 5 or more of
my list and then have a sidebar in this list so I can roll down the
list and select one.
Well this should be easy to do.
option 1) do a limit on your find operation:
@products = Product.find(:all, :limit => 5)
or option 2) simply grab the first 5 from the array
either way that will get you the first five to display.
Thanks, but I mean another thing. If i do what you suggested, I only
display de 5 first ones, and never display the other ones. I want to
display only five and with a bar be able to scroll down and see the
other ones.