Forum: Ruby on Rails What is wrong with my sql statement??

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.
brutyn_nick (Guest)
on 2005-11-17 13:06
(Received via mailing list)
hey, i want a list of callers, 10 per page, depending on which firm id
(in table

@callerid_pages, @callerids = paginate :caller_ids, :conditions =>
["caller_ids.geotag_id = and geotags.firm_id = ?" , firm_id],
:order_by => "geotags.address1 ASC" , :include=>[:geotag], :per_page =>

and i get this error

#42S02Unknown table 'geotags' in where clause: SELECT COUNT(*) FROM
WHERE (caller_ids.geotag_id = and geotags.firm_id = 1)

christopher.k.hall (Guest)
on 2005-11-17 13:45
(Received via mailing list)
try using :joins instead of :include

@callerid_pages, @callerids = paginate :caller_ids, :conditions =>
["ci.geotag_id = <> and gt.firm_id = ?" , firm_id],
:order_by => "gt.address1 ASC" , :joins => "as ci, geotags as gt",
=> 10
This topic is locked and can not be replied to.