> Try adding after this line:
>
> p person
>
> or
>
> puts person.inspect
>
> Run the code. Then run it again without the ".first" and see what the
> difference is.


Hello. Ahead of you on that one, but I still don't understand.  What can 
I say, I'm stupid.

"puts person.inspect" returns:
{"id"=>3, "name"=>"Dave Ellefson", "job"=>"Bassist", "gender"=>"Male", 
"age"=>47, 0=>3, 1=>"Dave Ellefson", 2=>"Bassist", 3=>"Male", 4=>47}

I understand why it's in the form of a hash (because of 
$db.results_as_hash = true).  What I don't understand is why the 
repeated values? Take note of the number of elements, I was expecting 5 
only (id, name, job, gender, and age), but it has 10 because the values 
(with 0,1,2,3,4 keys) were repeated.

Another thing I don't understand is that when I remove the ".first", run 
the program, enter a valid id or name, or just about anything really, it 
results in:

F:/Ruby/Practice/database3.rb:34:in `[]': can't convert String into 
Integer (TypeError)
        from F:/Ruby/Practice/database3.rb:34:in `find_person'
        from F:/Ruby/Practice/database3.rb:70:in `block in <main>'
        from F:/Ruby/Practice/database3.rb:57:in `loop'
        from F:/Ruby/Practice/database3.rb:57:in `<main>'

The 34th line is:
puts %Q{Name: #{person['name']}

Help pls? Thanks so much!

-- 
Posted via http://www.ruby-forum.com/.