Forum: Ruby on Rails Problem with find and join (wrong id?)

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.
christer.nilsson (Guest)
on 2005-11-14 01:32
(Received via mailing list)
This statement works correct in my controller (list action):

@reports = Report.find_by_sql("SELECT r.* FROM reports AS r INNER JOIN
Users AS u ON r.user_id = WHERE " + cond + " ORDER BY
flightnumber, flightdate")

This statement does not:

@reports = Report.find(:all, :order => "flightnumber, flightdate",
:conditions => cond, :joins => "AS r INNER JOIN Users AS u ON
r.user_id =")

All the ID:s in Show are the same for every record!
It seems is used instead of as the report identifier.

What am I doing wrong?
This topic is locked and can not be replied to.