我的Project
模型中有一个序列化字段,称为排名。
serialize :rankings
以下是一些带有结果的查询:
@projects = Project.where("rankings IS NULL") -> 0 results
@projects = Project.where("rankings = ?", "") -> 0 results
@projects = Project.where("rankings = ?", {}) -> 0 results
@projects = Project.where("rankings = ?", "{}") -> 0 results
@projects = Project.where("rankings = ?", {}.to_yaml) -> 0 results
Project.find(275).rankings -> nil
这是针对具有 100 个 nil 的表(其中 #275 是一个)。这是怎么回事?