Hi all!
I do:
Order.find(:all, :conditions => "created_at>='#{DateTime.now.year}-#{month}-1' and created_at<='#{Date.new(DateTime.now.year, month.to_i, -1)}'")
That is working fine except that everything created on the last day of the month is not included. Created_at might contain: "2010-09-30 18:34:09". That is NOT less than or equal to "2010-09-30". I know that I could just change the method to this:
Order.find(:all, :conditions => "created_at>='#{DateTime.now.year}-#{month}-1' and created_at<='#{Date.new(DateTime.now.year, month.to_i, -1)} 23:59:59'")
...but that seems kind of wrong. Is there a smarter way to do it?