Rails 4到where.not和OR

时间:2014-09-23 09:11:09

标签: ruby-on-rails-4 rails-activerecord where-clause

尝试重写此条款:

where("authorized_at IS NOT NULL OR paid_at IS NOT NULL")

到那个更漂亮的人:

where.not(authorized_at: nil, paid_at: nil)

但是产生" authorized_at IS NOT NULL AND paid_at IS NOT NULL"。有没有办法用where.not重写它?

1 个答案:

答案 0 :(得分:0)

我能得到的最好的是:

where.not("authorized_at IS NULL AND paid_at IS NULL")

奇怪的是哈希对应的工作方式不一样......