Problem with find and join (wrong id?)


#1

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 = u.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 = u.id”)

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

What am I doing wrong?