dlt/pilha — Issue #8: Ruby's first and count methods don't work on returned collection
Author: marcamillion
Created: 2011-12-04 01:40:35+00:00
State: open

So say I do:

q = Question.find_by_user_id(91970)

It returns a long list of stuff,

but if I do:

ruby-1.9.2-p0 > q.count
=> nil
ruby-1.9.2-p0 > q.first
=> nil

At first I thought it was maybe a Ruby 1.9.2 issue, but then I tried it in 1.8.7 and am getting the same issue.

How do I iterate through a collection and get Ruby's array methods to work?

The irony is, that you seem to have used .first in the library of Pilha, so not sure what's happening here.