Picking up a rails project for the first time in a few months and drawing a blank here… I want to compare a created_at datetime field in a find() call @users_week = User.count( :conditions => “created_at > ‘#{ 7.days.ago}’”) MySQL doesn’t like the format of that date so I added this: class Time def to_db self.strftime(“%Y-%m-%d %H:%M:%S.0”) end end and then: @users_week = User.count( :conditions => “created_at > ‘#{7.days.ago.to_db}’”)
I’m sure there is a ‘dead simple’ way to do this
thanks