Sha256: d143dd9dc5bd28dfd149568ee564b337819c3c5b7d87fcb6e0297fefa0424d07

Contents?: true

Size: 377 Bytes

Versions: 2

Compression:

Stored size: 377 Bytes

Contents

module ActiveArchive
  module Methods

    def archivable?
      columns.lazy.detect { |c| c.name == 'archived_at'.freeze }
    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.lazy.each { |r| r.unarchive }
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_archive-2.4.0 lib/active_archive/methods.rb
active_archive-2.3.0 lib/active_archive/methods.rb