包含STI的活动记录不起作用

时间:2019-01-16 12:01:02

标签: ruby-on-rails ruby activerecord

我有以下型号:

class User < ApplicationRecord
end

class Employer < User
  has_many :jobs
  has_one :profile
end

class JobSeeker < User
end

class Profile < ApplicationRecord
  belongs_to :employer
end

class Job < ApplicationRecord
  belongs_to :employer
end

雇主的个人资料上有一个经过验证的属性。我需要获得已核实雇主资料的工作清单。为此,我尝试了:

Job.includes(employer: :profile).where(profiles: {verified: true})

但这给了我错误

  

Job :: ActiveRecord_Relation:0x3ff5d9d4a878

我没有弄错。预先谢谢你

0 个答案:

没有答案