Rails 2.3.2, Ruby 1.9.3

I want to get all records for one month from charges table.

recs = Charge.where(["date >= ? and date < ?", t.beginning_of_month,
t.next_month.beginning_of_month])

and this transforms into this query on PostgreSQL

SELECT "charges".* FROM "charges" WHERE (date >= '2012-03-31
22:00:00.000000' and date < '2012-04-30 22:00:00.000000')

Which is wrong. Dates should have been 2012-04-01 00:00:00.000000 and
2012-05-01 00:00:00.000000

What is wrong?

by
TheR

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to