Sha256: 588ab8aedf8154e1f2768ff6f99283af9cdbcbdb624f3f3bd6c97b7635e3f0a2

Contents?: true

Size: 393 Bytes

Versions: 9

Compression:

Stored size: 393 Bytes

Contents

# frozen_string_literal: true

module ActiveArchive
  module Methods

    def archivable?
      columns.detect { |col| col.name == 'archived_at' }
    end

    def archive_all(conditions = nil)
      conditions ? where(conditions).destroy_all : destroy_all
    end

    def unarchive_all(conditions = nil)
      (conditions ? where(conditions) : all).to_a.each(&:unarchive)
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
active_archive-5.1.7 lib/active_archive/methods.rb
active_archive-5.1.6 lib/active_archive/methods.rb
active_archive-5.1.5 lib/active_archive/methods.rb
active_archive-5.1.4 lib/active_archive/methods.rb
active_archive-5.1.3 lib/active_archive/methods.rb
active_archive-5.1.2 lib/active_archive/methods.rb
active_archive-5.1.1 lib/active_archive/methods.rb
active_archive-5.1.0 lib/active_archive/methods.rb
active_archive-5.0.0 lib/active_archive/methods.rb