I have a table of deals and need to find records where the date matches today\'s date.
From the rails console, the date field I need to match looks like this. I\'ve assi
For those still on Rails 4:
To augment not_a_patch's answer above, I would use:
Deal.where(start: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day)
because Time.zone will use UTC (which is how your date time field is stored) while DateTime.now will not.
> DateTime.now
=> Fri, 08 Sep 2017 11:28:21 -0400
> Time.zone.now
=> Fri, 08 Sep 2017 15:29:53 UTC +00:00