I have a model Planning
with a start_time
attributes.
Say I would like to get all the plannings that are between 9AM and 12PM OR between 6PM and 11PM.
Basically I would do:
Planning.where do
(start_time >= @start_time[0]) & (start_time <= @end_time[0])
|
(start_time >= @start_time[1]) & (start_time <= @end_time[1])
end
The thing is that the number of time slots varies... Any thougths?
If it can help, I use Squeel gem.
Thanks in advance!