Comparing Ruby time with SQL time

Hi Dave,

Dave A. wrote:

I want to grab all rows in a database posted less than
24 hours ago. Here's what I have in my controller:

def stats
now = Time.now
recipe_yesterday = now.yesterday
@recipes = Recipe.find(:all, :conditions => "date_added >
#{recipe_yesterday}")
end

Try:
@recipes = Recipe.find(:all, :conditions => ["date_added > ?", recipe_yesterday])

hth,
Bill