Module: DateScope::Extension

Defined in:
lib/datescope/extension.rb

Instance Method Summary collapse

Instance Method Details

#last_monthObject



16
17
18
# File 'lib/datescope/extension.rb', line 16

def last_month
  where("created_at >= ? and created_at <= ?", Intervals.last_month[:start], Intervals.last_month[:end])
end

#month_before_last_monthObject



20
21
22
# File 'lib/datescope/extension.rb', line 20

def month_before_last_month
  where("created_at >= ? and created_at <= ?", Intervals.month_before_last_month[:start], Intervals.month_before_last_month[:end])
end

#this_monthObject



12
13
14
# File 'lib/datescope/extension.rb', line 12

def this_month
  where("created_at >= ?", Intervals.this_month[:start])
end

#this_weekObject



8
9
10
# File 'lib/datescope/extension.rb', line 8

def this_week
  where("created_at >= ?", Intervals.this_week[:start])
end

#this_yearObject



24
25
26
# File 'lib/datescope/extension.rb', line 24

def this_year
  where("created_at >= ?", Intervals.this_year[:start])
end

#todayObject



4
5
6
# File 'lib/datescope/extension.rb', line 4

def today
  where("created_at >= ?", Intervals.today[:start])
end