Comparing a Date to the Datetime Created_at in rails3
In postgres, you can cast a timestamp as a date. For example:
Report.where("created_at::date = ?", Date.today - 1)
Extract date (yyyy/mm/dd) from a timestamp in PostgreSQL
You probably want something like this:
yesterday = Time.now - 1.day
user = User.find(user_id)
todaysReport = user.reports.where(["created_at >= ? AND created_at <= ?", yesterday.beginning_of_day, yesterday.end_of_day])