Module: Housekeeping::CombinedScopes::ClassMethods

Defined in:
lib/housekeeping/combined_scopes.rb

Instance Method Summary (collapse)

Instance Method Details

- (Scope) recent_from_project_id(project_id)

Parameters:

  • project_id (Integer)

Returns:

  • (Scope)


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

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

- (Scope) recently_updated(limit)

Parameters:

  • limit (Integer)

Returns:

  • (Scope)


26
27
28
# File 'lib/housekeeping/combined_scopes.rb', line 26

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