Hi everyone,
‘Person’ migration includes timestamps.
I want to find every person created ‘today’.
Tried the command below, but I think it compares hour,minute and seconds
too. I just want to compare day,month and year.
Person.find(:all, :conditions => {:created_at => Time.now})
Hi everyone,
‘Person’ migration includes timestamps.
I want to find every person created ‘today’.
Tried the command below, but I think it compares hour,minute and seconds
too. I just want to compare day,month and year.
Person.find(:all, :conditions => {:created_at => Time.now})
You can’t use the hash form of :conditions for this. You need to ask
the database for those records with a created_at in a certain range
(exactly what range will depend on your definiiton of today: past 24
hours or since midnight)