query where date = Date.today with Rails, MySQL, and Active Record

后端 未结 3 1072
日久生厌
日久生厌 2021-02-12 23:11

I see in the Active Record docs, you can query for a date using a greater than / less than comparison. However, what if you want to select where date = Date.today or must I quer

3条回答
  •  执念已碎
    2021-02-13 00:09

    For me just works like this:

    @fisrt_payment_day = Invoice.where("DATE(date_first_payment) >= ?", Date.today - 1.day)
    

提交回复
热议问题