Topic: find :all, :conditions => using datetime
Hi there,
I'm new at ruby on rails and can't find the correct way to work with dates and datetimes as part of the condition of a find.
I want to find all ActiveRecords between two datetimes (start_date and end_date):
bugs = Bug.find :all,
:order => 'id DESC',
:conditions => 'status_id = "3" AND date_fixed > ' + start_date + ' AND date_fixed <= ' + end_date + ' AND product_id = ' + params[:id]
Is there a direct way to pass dates/datetimes onto a query for comparison?
Is the way that I've written the condition above ok, is there a preferrred method to pass multiple conditions?
Any help greatly appreciated.
Regards,
Fabricio.