lib/active_archive/methods.rb in active_archive-5.1.7 vs lib/active_archive/methods.rb in active_archive-5.2.0

- old
+ new

@@ -6,14 +6,22 @@ def archivable? columns.detect { |col| col.name == 'archived_at' } end def archive_all(conditions = nil) - conditions ? where(conditions).destroy_all : destroy_all + (conditions ? where(conditions) : all).to_a.each(&:archive) end + def archive_all!(conditions = nil) + (conditions ? where(conditions) : all).to_a.each { |r| r.send(:archive, :force) } + end + + alias_method :destroy_all!, :archive_all! + def unarchive_all(conditions = nil) (conditions ? where(conditions) : all).to_a.each(&:unarchive) end + + alias_method :undestroy_all, :unarchive_all end end