I am trying to retrieve an activerecord object from my db. My models are
class User < ActiveRecord::Base belongs_to :account has_many :domains, :thr
The following piece of code did the trick:
User.joins(:account).joins('INNER JOIN "domains" ON "accounts"."id" = \ "domains"."account_id"').where(:users => {"username" => "Paul"}). where(:domains => {"name" => "paul-domain"})
Sorry about the formatting of this long line of code