Class: Tartarus::ArchivableCollectionRepository
- Inherits:
-
Object
- Object
- Tartarus::ArchivableCollectionRepository
- Defined in:
- lib/tartarus/archivable_collection_repository.rb
Instance Method Summary collapse
-
#initialize(const_resolver: Object) ⇒ ArchivableCollectionRepository
constructor
A new instance of ArchivableCollectionRepository.
- #items_older_than(model_name, timestamp_field, timestamp) ⇒ Object
- #items_older_than_for_tenant(model_name, timestamp_field, timestamp, tenant_id_field, tenant_id) ⇒ Object
Constructor Details
#initialize(const_resolver: Object) ⇒ ArchivableCollectionRepository
Returns a new instance of ArchivableCollectionRepository.
6 7 8 |
# File 'lib/tartarus/archivable_collection_repository.rb', line 6 def initialize(const_resolver: Object) @const_resolver = const_resolver end |
Instance Method Details
#items_older_than(model_name, timestamp_field, timestamp) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/tartarus/archivable_collection_repository.rb', line 18 def items_older_than(model_name, , ) collection = collection_for(model_name) ensure_column_exists(collection, model_name, ) collection.where("#{} < ?", ) end |
#items_older_than_for_tenant(model_name, timestamp_field, timestamp, tenant_id_field, tenant_id) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/tartarus/archivable_collection_repository.rb', line 10 def items_older_than_for_tenant(model_name, , , tenant_id_field, tenant_id) collection = collection_for(model_name) ensure_column_exists(collection, model_name, ) ensure_column_exists(collection, model_name, tenant_id_field) collection.where("#{} < ?", ).where(tenant_id_field => tenant_id) end |