Topic: newbie question on arrays (take 2..)

I've got an array set up like this:

class USERS
PEOPLE = ["jack", 32, 175, 168],
         ["sarah", 25, 110, 155],
         ["ricky", 44, 200, 170]

I'm not sure what that's called.. an array, an array of arrays?  Anyway, what I want to do is get just a list of the names (jack, sarah, ricky) and then pass the other 2 variables to my controller based on which name is selected.

Do I have to put this into a database or is there a way to grab what I need to?

Re: newbie question on arrays (take 2..)

I'd stick all this information into a hash personally, just to make it a bit more obvious what everything is.

That said you can use the find method for this:

>> person = PEOPLE.find { |p| p[0] == "jack" } # Find the array where element 0 equals "jack"
=> ["jack", 32, 175, 168]
>> [person[1], person[2]]
=> [32, 175]

To find only the names of each 'record' you can use collect:
>> PEOPLE.collect { |p| p[0] } # Take element 0 of each array and create a new array out of the results
=> ["jack", "sarah", "ricky"]