Sha256: cfb6494983ad4f570da6fac9d1dbff808b20425b1dcf0f137b8fbda5a1c3882d

Contents?: true

Size: 368 Bytes

Versions: 3

Compression:

Stored size: 368 Bytes

Contents

module ActiveArchive
  module Methods

    def archivable?
      columns.detect { |column| column.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

3 entries across 3 versions & 1 rubygems

Version Path
active_archive-4.0.2 lib/active_archive/methods.rb
active_archive-4.0.1 lib/active_archive/methods.rb
active_archive-4.0.0 lib/active_archive/methods.rb