2

I have an array "$a" and the below code in my view displays all the elements in a single column. How do I display them into 5 columns?

<ul>  
 <% for w in $a %>    
   <%= w %><br/>
 <% end %>  
</ul>
1
  • Please show us the "below code" Commented Nov 5, 2010 at 2:41

1 Answer 1

3

See this question Display 5 records per row?

 <% @tags.in_groups_of(5).each do |tag_array| %>
      <% tag_array.each |tag| %>
      will output 5 tags here
      <% end %>
 <% end %>
Sign up to request clarification or add additional context in comments.

2 Comments

<% $a.in_groups_of(5).each do |t1| %> <% t1.each do |t2| %> <%= t2 %> <% end %><br/> <% end %>
<% tag_array.each |tag| %> should be <% tag_array.each do |tag| %>.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.