Reputation: 1202
In Rails 6, how can I write a where
query who find all records with a date attributes that is a monday ?
Something like : Appointment.where(date: monday?)
or Appointment.where('date.wday': 1)
Upvotes: 2
Views: 203
Reputation: 1202
This is working with Postgres :
Appointment.where("extract(dow from date) = ?", Date.current.monday.wday)
Upvotes: 2