Rails `where` for time less than queries

前端 未结 4 1913
礼貌的吻别
礼貌的吻别 2020-12-28 18:13

Setup

Rails\' where method can take a range in a hash to generate a query that will search for a value that is within the range. For example:

4条回答
  •  醉酒成梦
    2020-12-28 18:44

    You need to use the appropriate infinity. A timestamp is a DateTime not a Date. Use DateTime::Infinity.new instead or DateTime::Infinity.new(-1) for negative infinite.

    Related: Is there a way to express 'Infinite Time' in Ruby?

提交回复
热议问题