Rails/SQl query help: Find all by created_at in past 7 days per each day?

Posted by Senthil on Stack Overflow See other posts from Stack Overflow or by Senthil
Published on 2010-05-27T00:45:16Z Indexed on 2010/05/27 1:11 UTC
Read the original article Hit count: 255

Filed under:
|
|

I'm unable to get SQL and Rails to play properly when trying to find Categories that are created each day, the past 7 days.

So basically I want to find each Category sorted by the day they were created for the past 7 days.

I found this on stackoverflow, but it isn't finding a Category that I just created:

Category.all(:conditions => ["created_at > ? AND created_at < ?", t.at_beginning_of_day, t.tomorrow.at_beginning_of_day])

Any help?

© Stack Overflow or respective owner

Related posts about sql

Related posts about activerecord