Topic: filtering records by date posted.

i'm building an application that has a posts table with a date_time row.

when i list these posts i need to be able to filter them by posts created during the last[day,week,month,year]

how would i go about finding records in my database within those conditions?

Re: filtering records by date posted.

Post.find(:all, :conditions => ['created_at >= ?', 1.day.ago])

You  can replace "day" with week, month, year, etc.

Railscasts - Free Ruby on Rails Screencasts

Re: filtering records by date posted.

excellent, thanks for your help.