I need to add a date comparison in a query.
The field is column delivery_date timestamp without time zone
The condition should be delivery_date <= today.
I have tried :
"delivery_date < ?", Date.today
delivery_date.lt(Date.today)
"delivery_date" <= time.now [Error : NameError - undefined local variable or method `time' for ]
"delivery_date" <= Time.now [Error : ArgumentError - comparison of String with DateTime failed: ]
but I am getting different errors with all.
Here is the query where I need to add my condition :
datas: tab.project
.active
.where("delivery_date" <= date.today, step_id: Step::OPENED, test: {typess: type})
.joins(:test, :account)
.group(:'account.name')
.order('count(tab.id) DESC')
.count(:id)
Any idea how it should be done?