Rails - call method on a field within a where clause -
this question has answer here:
- rails activerecord date between 11 answers
i want extract exchange rates today(ie. exchange rates have time field of type datetime , want extract day). want this:
exchangerates.where("time.day == ?", pred.time) is of kind possible?
your database doesn't have datetime object in works rails datetime object. in order query you'll have send understands, between clause. this:
exchangerates.where(time: pred.time.beginning_of_day..pred.time.end_of_day) i'm assuming pred datetime object
Comments
Post a Comment