Strange sql being generated

Hello all,

I’ve got a class method, as follows -

def self.highest_rated(count)
Spotguide.find(:all, :limit => 3, :include => :spotcomments, :joins
=> ‘INNER JOIN contents on contents.parent_id = spotguides.id AND
contents.type = “Spotcomment”’, :group => ‘contents.parent_id’, :order
=> “avg(contents.rating)”)
end

(I welcome any more efficient ways of doing this!)

the :limit parameter seems to add a WHERE spotguides.id IN (‘4’) to the
generated sql string rather than adding LIMIT 3 at the end.

Does anyone have any ideas what might be going on here? I’m using RC2
of rails 1.2

Cheers,

Alastair