如果填入日期(如in,not null),您如何檢查Rails3(帶或不帶Arel)?我知道你可以使用它:查看日期不爲空? (rails,arel)
obj.where('PLANNED IS NOT NULL')
但是它可能沒有使用SQL?
// SQL
SELECT * FROM projecttasks WHERE planned IS not null
我想:
# all tasks which have a date
tasks = Projecttask.where(:planned => !nil)
或
# all task with no planned date (sql: is null)
Projecttask.where(:planned => nil)
但是,這並不工作。一般來說,如何在NULL和NON NULL列上執行'where'操作。
謝謝。
的可能重複的[軌3,其中使用NOT NULL條件](http://stackoverflow.com/questions/4252349/rail-3-where-condition-using-not-null) –