2
scope :delivered, where(:status => Status::DELIVERED)
SELECT "orders".* FROM "orders" WHERE "orders"."status" IN ('Pending', 'Partially Prepared')
现在我要添加新的范围,以获得所有除交付的订单。
scope :not_delivered, where(:status != Status::DELIVERED)
SELECT "orders".* FROM "orders" WHERE ('t')
如何获得反向范围?
应该是'scope:not_delivered,where('status!=?',Status :: DELIVERED)' – Egor 2012-12-20 10:12:49