Module: Pageflow::AutoSnapshotPruning Private
- Extended by:
- AutoSnapshotPruning
- Included in:
- AutoSnapshotPruning
- Defined in:
- app/models/pageflow/auto_snapshot_pruning.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #dirty_entry_ids(options) ⇒ Object private
- #prune(entry, options) ⇒ Object private
Instance Method Details
#dirty_entry_ids(options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
6 7 8 9 10 11 12 13 14 |
# File 'app/models/pageflow/auto_snapshot_pruning.rb', line 6 def dirty_entry_ids() Revision .auto_snapshots .where('created_at < ?', .fetch(:created_before)) .select('COUNT(*) as revisions_count, entry_id') .group('entry_id') .having('revisions_count > ?', .fetch(:keep_count)) .map(&:entry_id) end |
#prune(entry, options) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 |
# File 'app/models/pageflow/auto_snapshot_pruning.rb', line 16 def prune(entry, ) entry .revisions .auto_snapshots .where('created_at < ?', [:created_before]) .order('created_at DESC') .offset([:keep_count]) .each(&:destroy) end |