Sha256: 2167e27e3828abf60b7bb17cdfb533ac43aea44e1d62e7944e45f0b13b2ea5bb

Contents?: true

Size: 361 Bytes

Versions: 1

Compression:

Stored size: 361 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

1 entries across 1 versions & 1 rubygems

Version Path
active_archive-3.0.0 lib/active_archive/methods.rb