Count records returned by find?

I just want to create a simple “no records returned” -
using this statement though

@positions = pq.find
if @positions.count < 1

generates
“undefined method `count’ for #Array:0x4b0adc8”

I’m not looking to apply any conditions only total records returned by
the
find.

Anyway tell me what I’m doing wrong ?
Stuart

–

On Oct 14, 7:18 am, “Dark A.” [email protected] wrote:

find.

Anyway tell me what I’m doing wrong ?
Stuart

–Dark ambient - Wikipedia

You can do…

“Nothing found” unless @positions.empty?
or
“Nothing found” if @positions.size == 0

_Kevin

You can also use count_by_sql for just counting the results. Here is
an example:

Gift.count_by_sql(“select count(distinct url) from gifts”)

It can be any sql statement that returns a count().

Tom

On 10/14/06, _Kevin [email protected] wrote:

generates
You can do…

“Nothing found” unless @positions.empty?
or
“Nothing found” if @positions.size == 0

_Kevin

–
Tom D.

http://atomgiant.com
http://gifthat.com

On 10/14/06, _Kevin [email protected] wrote:

–Dark ambient - Wikipedia

You can do…

“Nothing found” unless @positions.empty?
or
“Nothing found” if @positions.size == 0

_Kevin

Thanks guys (Kevin and Tom)

I went with @positions.size and that works good.
However , and this might be another thread all together I’m noticing a
little freaky behaviour.
This is an ajax form taking user conditions -
what I’m finding is the first time it hits a condition that returns no
records it won’t say no records found.
if I go back , clear the condition and put it in again , then it will.

Sound weird ?

Stuart