我有一个模型任务
t.string "name"
t.hstore "actions"
例子:
#<Task id: 1, name: "first", actions: {"today"=>"9"},
#<Task id: 2, name: "second", actions: {"yesterday"=>"1"},
#<Task id: 3, name: "third", actions: nil,
#<Task id: 4, name: "four", actions: {"today"=>"11"},
我需要找到所有操作的记录:nil,:today<10 和 key:today 不存在。这是1,2,3任务。
Task.where("actions -> 'today' < '10'") - it return only first task.
Task.where("actions -> 'today' < '10' OR actions IS NULL") - it return 1 and 3 records.
我怎样才能找到所有没有关键的记录:今天在行动?