我正在尝试在我的模型上执行此查询,但我无法弄清楚。
- An event has a date.
I have an array of date called "array_of_dates", I have built it from another model:
array_of_dates = [] user.each do |user| array_of_dates << user.birthday_date end
- user.birthday_date is of course a datetime
Event.where("date in (?)", array_of_dates)
然而,来自事件的日期也有一个设置的时间。我想忽略这里设置的时间,因为我只是寻找那一天。我尝试将user.birthday_date解析为另一种格式,但我不知道如何改变Event模型中“date”的格式。
感谢您的帮助!