Forum: Ruby on Rails RE: find by sql

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.
Bharat A. (Guest)
on 2006-05-31 16:12
(Received via mailing list)
>     @invoices = Invoice.find_by_sql(pSql);

Try @invoices = Invoice.find(:all, :select => "Distinct,
invoices.invoice_number, invoices.approve_date,invoices.sent_date,
				       : join => " ,projects, payments",

				       :Conditions =>[" =
payments.project_id AND payments.invoice_id = AND = ?",params[:id]])

Although I have not tried it, it should work. If not take a look at the
log file to see what is the sql being generated and customize the above
statement accordingly.

This topic is locked and can not be replied to.