Search results

Assuming you are referring to Rails specifically, not just Ruby. As an aside, get the book Agile Web Development with Rails. (Use the Google).

ActiveRecord’s finders either return an array:

@users = User.find(:all, :conditions => [‘name = ?’, ‘scott’])

or one object

@user = User.find (1) # gets the user with an ID of one.

to iterate, you can use .each:

@users.each do |user| puts user.name end