我尝试查询排除作为 cookie 保存的 id 数组列表。我被困住了
where('author_name iLIKE ? OR quote iLIKE ? AND id NOT IN ?', "%#{search}%", "%#{search}%", "#{disable}").all(:order => sorting)
从上面的这段代码中,它将生成这条 SQL 语句:
SELECT * FROM quotations WHERE author_name LIKE '%' + 'search' + '%' OR quote LIKE '%' + 'search' + '%' AND id NOT IN (1,2,3)