WHAT IS IT?
Allows you to easily do queries based on date ranges.
You can either pass a symbol:
:today, :yesterday, :last_year, :this_year, :next_year, :this_month,
:last_month, :next_month, :month_to_date
Or you can pass a range:
5.days.ago .. 10.days.from_now
Examples
Book.when(:yesterday).count # defaults filtering based on created_at field
Book.when(:this_month,:updated_at).count
Book.when(Date.civil(2002)..Date.civil(2006),:deleted_at).count