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)
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)
This is working with Postgres :
Appointment.where("extract(dow from date) = ?", Date.current.monday.wday)