I have model called Slot, which has a start_on and end_on, both of which
are dates.
A Team has_many Slots.
The two things I’m looking to do are:
- Ensure that newly created slots dont overlap any existing ones for a
particular team. - Quickly retrieve the ‘current’ slot given a Team and Time.now.
I can figure out how to do these two operations with a bit of grunting
and sweaty brute force, but I’m wondering if anyone with a bit more
ActiveRecord-fu can help me out with any shortcuts to something more
beautiful.
Any help appreciated.
A.