Module: DateScope::Extension
- Defined in:
- lib/datescope/base.rb
Instance Method Summary collapse
- #last_month ⇒ Object
- #month_before_last_month ⇒ Object
- #this_month ⇒ Object
- #this_week ⇒ Object
- #this_year ⇒ Object
- #today ⇒ Object
Instance Method Details
#last_month ⇒ Object
16 17 18 |
# File 'lib/datescope/base.rb', line 16 def last_month where("created_at >= ? and created_at <= ?", 1.month.ago.beginning_of_month, 1.month.ago.end_of_month) end |
#month_before_last_month ⇒ Object
20 21 22 |
# File 'lib/datescope/base.rb', line 20 def month_before_last_month where("created_at >= ? and created_at <= ?", 2.month.ago.beginning_of_month, 2.month.ago.end_of_month) end |
#this_month ⇒ Object
12 13 14 |
# File 'lib/datescope/base.rb', line 12 def this_month where("created_at >= ?", 0.month.ago.beginning_of_month) end |
#this_week ⇒ Object
8 9 10 |
# File 'lib/datescope/base.rb', line 8 def this_week where("created_at >= ?", 0.week.ago.beginning_of_week) end |
#this_year ⇒ Object
24 25 26 |
# File 'lib/datescope/base.rb', line 24 def this_year where("created_at >= ?", 0.year.ago.beginning_of_year) end |
#today ⇒ Object
4 5 6 |
# File 'lib/datescope/base.rb', line 4 def today where("created_at >= ?", 0.day.ago.beginning_of_day) end |