Ruby on Rails Friday, April 1, 2011

Sent from my iPhone

On Apr 1, 2011, at 2:16 AM, Manny 777 <lists@ruby-forum.com> wrote:

No no, the exactly error is "undefined method `sequence' for
nil:NilClass".

It looks I am getting the database object in var "high",  but I can't to
get individual items from this object (like "sequence" or "name"). When
I am trying to print the sequence (puts high.sequence), I am getting
error "undefined method `sequence' for nil:NilClass".

This is because more than one record has been returned with your find or it returned you single record search as an array. You have to loop over the items in the collection "high" then you will be able to access each items method. 

B.

No comments:

Post a Comment