Rails where date is greater than given date query

后端 未结 3 1065
独厮守ぢ
独厮守ぢ 2021-02-03 17:04

Trying to search where movies coming out have a release date greater than today\'s date

 Movie.where(\'release > ?\', Date.today)
ActiveRecord::StatementInval         


        
3条回答
  •  情深已故
    2021-02-03 17:43

    Rails 3+ :

    Movie.where('release > ?', DateTime.now)
    

    Pre Rails 3

    Movie.where(['release > ?', DateTime.now])
    

提交回复
热议问题