I'm totally rails newbie, and just started it a couple of days ago
moving from PHP, so I've the following query, and want to know how can
I do it using ActiveRecord
SELECT `sites`.*, `snapshots`.*, `technologies`.*
FROM `sites`, `snapshots`, `technologies`
WHERE `sites`.id = '1'
AND
On 11 November 2011 12:02, Mahmoud Abdel-Fattah
mahm...@abdel-fattah.net wrote:
I'm totally rails newbie, and just started it a couple of days ago
moving from PHP, so I've the following query, and want to know how can
I do it using ActiveRecord
SELECT `sites`.*, `snapshots`.*,
I think what you are trying to do is joins
if your associations are set correctly, then something like below should
work
Site.joins(:snapshots).joins(:technologies).where(sites.id=1)
*Note: *in the where clause, you cannot use :id=1 because :id with the
joined tables will be ambigious... you
3 matches
Mail list logo