下面的代碼片段如何哪裏都不在軌道3件作品
Wip.where(status: "P").where("reason NOT IN ?", ['DOB_MISSING'])
這是行不通的。
我試過尋找它,發現了很多問題。他們中有些人提出這一點,但我不知道我要去的地方錯了
在這裏,我貼我的導軌的部分c
[19] pry(main)> Wip.where(status: "P").where("reason NOT IN ?", ['DOB_MISSING']).count
(0.6ms) SELECT COUNT(*) FROM `wip` WHERE `wip`.`status` = 'P' AND (reason NOT IN 'DOB_MISSING')
ActiveRecord::StatementInvalid: Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''DOB_MISSING')' at line 1: SELECT COUNT(*) FROM `wip` WHERE `wip`.`status` = 'P' AND (reason NOT IN 'DOB_MISSING')
from /home/ritu/.rvm/gems/[email protected]/gems/rack-mini-profiler-0.9.7/lib/patches/db/mysql2.rb:20:in `query'
不起作用?有什麼錯誤? – CuriousMind
@CuriousMind我已經添加了錯誤部分 – aelor