作成日: 2020/04/24 17:59:08
更新日: 2020/04/24 18:00:46
Rails
Active Record
限定公開
datetime型をDATEに変換してwhere
rails where date datetime
https://stackoverflow.com/questions/45436232/rails-convert-datetime-to-date-in-where-query/45436533
```
scope :day, -> (start_date) {where("DATE(start_date) = ?", start_date)}
```
```
Schedule.where("DATE(expired_at) = ?", Time.zone.today + Schedule::EXPIRED_PERIOD)
```