0
我有以下的关联:怎么办在轨获得从另一个表查询从一个表两列,一列此查询
类资源<的ActiveRecord :: Base的 belongs_to的:笔者
def self.search(search)
where('title ILIKE ? OR description ILIKE ?', "%#{search}%","%#{search}%")
end
我需要寻找作者的名字,如下:
where('title ILIKE ? OR description ILIKE ? OR author_name ILIKE ?', "%#{search}%","%#{search}%","%#{search}%")
末
这显然不会工作,因为我在资源表中有author_id而不是作者姓名字段。
我是NOOB所以任何帮助赞赏
感谢