.joins(:residence) .where('(custom_services.date_from - ?) <= 1', Date.today)
Does anyone know how to correctly implement a check the difference between the date in custom_services.date_from and today's is less than or equal to one day(in the screenshot, one of the attempts is not correct)
CodePudding user response:
Using Date.tomorrow
and beginless range:
.where(date_from: ..Date.tomorrow)
if need to specify table name
.where('custom_services.date_from': ..Date.tomorrow)
CodePudding user response:
you can just use
.where('custom_services.date_from <= ?', Date.today 1.day)
CodePudding user response:
Can you use something like this?
where("DATEDIFF(custom_services.date_from, ?) <= 1", Date.today)