So, I have a table that has two dates in it, a start and and an end date. I need to be able to query to find out all of the records that are within a certain week. So, for instance:
start: "2012-03-12 14:00:00", end: "2012-03-12 21:00:00"
start: "2012-03-13 14:00:00", end: "2012-03-13 21:00:00"
start: "2012-03-14 13:00:00", end: "2012-03-14 20:00:00"
start: "2012-03-15 15:00:00", end: "2012-03-15 22:00:00"
start: "2012-03-16 14:00:00", end: "2012-03-16 21:00:00"
I want to return all of these records by querying (somehow) “What records fall in the week of March 11 to March 17?”
I need to do this in ActiveRecord and Rails 3.2.1. Also, I would prefer if I could do this from another model. Like this dates belong to another model, let’s call it ModelA.
ModelA.dates.where(What ever I need to do)
Something like that?
Or: