Module: Housekeeping::CombinedScopes::ClassMethods

Defined in:
lib/housekeeping/combined_scopes.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) recent_from_project_id(project_id)



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/housekeeping/combined_scopes.rb', line 10

def recent_from_project_id(project_id)
  t = self.arel_table

  c = t[:project_id].eq(project_id).and(
    t[:created_at].gt(1.weeks.ago).
    or(t[:updated_at].gt(1.weeks.ago)
      )
  )

  where(c.to_sql) 
end

- (Object) recently_updated(limit)



22
23
24
# File 'lib/housekeeping/combined_scopes.rb', line 22

def recently_updated(limit)
  self.order(updated_at: :desc).limit(limit)
end