2
我的理解是可以做到如何使用“在哪里”,“有”和“或”
scope :public_visible, where("(status = ?) OR (end_date > ?)", :published, Date.today)
但我想要做的是以下两个作用域与OR
结合什么范围scope :succeeded, having("SUM(orders.sum) >= goal")
scope :ongoing, where("end_date >= ?", Date.today)
这可能吗?无论是以sql还是主动记录的方式。
谢谢大家。