Display an array into multiple columns in a view

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?

I am not sure if it should be done thru ruby code, or html tags or CSS.
Please suggest. thanks

    <% for w in $a %> <%= w %> <% end %>

Have a look at the Enumerable class:
http://ruby-doc.org/core/classes/Enumerable.html
each_slice in particular looks likely what you need.

Walter

On Fri, Nov 5, 2010 at 10:59 AM, Dv Dasari [email protected] wrote:

This is more of a CSS issue. Style your

  • 's as floated. Or you can
    just
    drop them in a .


    Erol M. Fornoles
    http://github.com/Erol
    http://twitter.com/erolfornoles
    http://ph.linkedin.com/in/erolfornoles

  • You may want to look into using a partial with a collection

    Walter D. wrote in post #959491:

    Have a look at the Enumerable class:
    http://ruby-doc.org/core/classes/Enumerable.html
    each_slice in particular looks likely what you need.

    Walter

    Thanks that worked

    This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

    | Privacy Policy | Terms of Service | Remote Ruby Jobs