Sha256: 85f3e51dc85cb8b80df43aaac197701aec0637cf88eb1996dd0f7a24012e5e2e
Contents?: true
Size: 660 Bytes
Versions: 75
Compression:
Stored size: 660 Bytes
Contents
module Pageflow # @api private module AutoSnapshotPruning extend self def dirty_entry_ids(options) Revision .auto_snapshots .where('created_at < ?', options.fetch(:created_before)) .select('COUNT(*) as revisions_count, entry_id') .group('entry_id') .having('revisions_count > ?', options.fetch(:keep_count)) .map(&:entry_id) end def prune(entry, options) entry .revisions .auto_snapshots .where('created_at < ?', options[:created_before]) .order('created_at DESC') .offset(options[:keep_count]) .each(&:destroy) end end end
Version data entries
75 entries across 75 versions & 1 rubygems