Rails where date is greater than given date query

后端 未结 3 1056
独厮守ぢ
独厮守ぢ 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:44

    In recent versions of rails, you can do this:

    User.where(created_at: 3.days.ago..Time.now)
    

    See some other examples here: https://stackoverflow.com/a/24150094

提交回复
热议问题