I'm working on a project dealing with opening hours of a store. I have Store and OpeningHour models, (Store has_many OpeningHour). The opening_hours table has day, start and end fields to store the day that OpeningHour record is to apply to, the time the store opens and the time the store closes.
What would be the best way of finding any records where the time range set by start and end fields covers Time.now?
Similar to the below conceptually:
OpeningHour.where((start..end).cover? Time.now)
Any help would be much appreciated!