From rubyonrails.org
Client.where ("created_at> =: start_date AND created_at <=: end_date", {: start_date => params [: start_date] ,: end_date => params [: end_date]})
or
Client.where ("created_at IN (?)", (PARAMS [: start_date] .to_date) .. (PARAMS [: end_date] .to_date))
Here is what I have for the request, all the time TimeSlot starts with "2010-09-08" if your start_date is a date field.
TimeSlot.where("start_date >= ? AND start_date <= ?", "2010-09-08", "2010-09-08")
If start_date is a datetime field.
TimeSlot.where("start_date >= ? AND start_date <= ?", "2010-09-08", "2010-09-09")
Since the date-time starts at 00:00:00
etlds source share