Sha256: 1ac382c3f9a515d1ea372c2c7e716b8d0fe80b9fdd907ab06328a28c83d6aa31

Contents?: true

Size: 360 Bytes

Versions: 7

Compression:

Stored size: 360 Bytes

Contents

module ActiveArchive
  module Methods

    def archivable?
      columns.detect { |c| c.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 { |r| r.unarchive }
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
active_archive-2.2.2 lib/active_archive/methods.rb
active_archive-2.2.1 lib/active_archive/methods.rb
active_archive-2.2.0 lib/active_archive/methods.rb
active_archive-2.1.0 lib/active_archive/methods.rb
active_archive-2.0.0 lib/active_archive/methods.rb
active_archive-1.0.0 lib/active_archive/methods.rb
active_archive-0.1.0 lib/active_archive/methods.rb