您好,我有此活动记录查询
whitelabel.users.joins(:personal_references).where("
personal_references.phone = ?", value)
此查询有效,但它返回用户数据,我如何获取个人参考数据?
答案 0 :(得分:0)
好吧,我觉得很抱歉,但是如果有人需要,我会离开这里
PersonalReference.joins("INNER JOIN users ON
personal_references.researchable_id = users.id and
personal_references.researchable_type = 'User'
INNER JOIN whitelabels ON whitelabels.id = users.whitelabel_id").
where("personal_references.phone = ?", values)