For Loop

If I have a loop, let’s say:

<% for user in @users %>

<%= link_to "#{user.his_uid}", :action => 'show', :id => user %> <%= link_to "#{user.his_uid}", :action => 'show', :id => user %> <% end %>

How can I get the second #{user.his_uid} to be the second object in
the list? Is there a method for this (object.next) or a special way of
making two columns tables?

Thanks in advance,
LP

On Dec 4, 2007 1:48 PM, [email protected] [email protected] wrote:

<% end %>

How can I get the second #{user.his_uid} to be the second object in
the list? Is there a method for this (object.next) or a special way of
making two columns tables?

Have a look at in_groups_of:

http://api.rubyonrails.com/classes/ActiveSupport/CoreExtensions/Array/Grouping.html


Greg D.
http://destiney.com/

Are you after something like this?

<% for user in @users %> <%= link_to user.his_uid, :action => 'show', :id => user %> <% end %>


Ryan B.

Thank you Greg! Exactly what I needed.

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