Module: Housekeeping::Timestamps::ClassMethods

Defined in:
lib/housekeeping/timestamps.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) created_in_last(time)

Otu.created_in_last(2.weeks)



33
34
35
# File 'lib/housekeeping/timestamps.rb', line 33

def created_in_last(time)
  where(created_at: time.ago..Time.now  )
end

- (Object) created_last(number = 10)



42
43
44
# File 'lib/housekeeping/timestamps.rb', line 42

def created_last(number = 10)
  limit(number).order(created_at: :DESC)
end

- (Object) created_this_week



16
17
18
# File 'lib/housekeeping/timestamps.rb', line 16

def created_this_week
  where(created_at: 1.weeks.ago..Time.now) 
end

- (Object) created_today



24
25
26
# File 'lib/housekeeping/timestamps.rb', line 24

def created_today
  where(created_at: 1.day.ago..Time.now)
end

- (Object) updated_in_last(time)

Otu.created_in_last(1.month)



38
39
40
# File 'lib/housekeeping/timestamps.rb', line 38

def updated_in_last(time)
  where(updated_at: time.ago..Time.now)
end

- (Object) updated_last(number = 10)



46
47
48
# File 'lib/housekeeping/timestamps.rb', line 46

def updated_last(number = 10)
  limit(number).order(updated_at: :DESC)
end

- (Object) updated_this_week



20
21
22
# File 'lib/housekeeping/timestamps.rb', line 20

def updated_this_week
  where(updated_at: 1.weeks.ago..Time.now) 
end

- (Object) updated_today



28
29
30
# File 'lib/housekeeping/timestamps.rb', line 28

def updated_today
  where(updated_at: 1.day.ago..Time.now)
end