Forum: Ruby on Rails strange sql being generated

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
8161659aadd1b5a5284c922022d26ac4?d=identicon&s=25 Alastair Moore (Guest)
on 2007-01-19 16:31
(Received via mailing list)
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 = AND
contents.type = "Spotcomment"', :group => 'contents.parent_id', :order
=> "avg(contents.rating)")

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

the :limit parameter seems to add a WHERE 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


This topic is locked and can not be replied to.