没有SQL的语法是什么?
Subscription.where('end_date > ?', Date.today)
我已经尝试过这个,但它显然是不正确的:
Subscription.where(:end_date > Date.today)
(我们正在使用导轨 3)谢谢!
通过使用 Arel:
Subscription.where(Subscription.arel_table[:end_date].gt(Date.today)).all
或者使用宝石尖叫:
Subscription.where(end_date.gt => Date.today).all