simple query..

hi,\

how do i get all records form my model, which are not older than 3 days ? Say i have column in my users table 'sign_in_date', i want retrieve all records with sign_in_date not older than 3 days from now.

thx

regards

three_days_ago = (DateTime.now - 3.days) YourModel.find(:all, :conditions => ['sign_in_date > ?', three_days_ago])

Jean-Sébastien pisze:

three_days_ago = (DateTime.now - 3.days) YourModel.find(:all, :conditions => ['sign_in_date > ?', three_days_ago])

3.days lol :slight_smile: great stuff man