Search results

Hi, I am new to Ruby, I am a Java expert.
I don’t know how to handle the results of a search… I have read a lot,
but nobody seems to give examples of that.
Do I get an ArrayList from a Table?
Do I get fields?
How can I identify them?
Do I have to parse them to a Class like: Person user =
Person(personlist.get(i));?

Please, help me…

On 6/7/07, Kesi A. [email protected] wrote:

Please, help me…

Assuming you are referring to Rails specifically, not just Ruby. As an
aside, get the book Agile Web D. 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


Scott B.
Electro Interactive, Inc.
Blog: http://synthesis.sbecker.net

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