Module: ActsAsArchive

Defined in:
lib/acts_as_archive.rb,
lib/acts_as_archive/base.rb,
lib/acts_as_archive/migration.rb,
lib/acts_as_archive/base/table.rb,
lib/acts_as_archive/base/destroy.rb,
lib/acts_as_archive/base/restore.rb,
lib/acts_as_archive/base/adapters/mysql.rb,
lib/acts_as_archive/base/adapters/postgresql.rb

Defined Under Namespace

Modules: Base, Migration

Class Method Summary collapse

Class Method Details

.update(*models) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/acts_as_archive.rb', line 6

def self.update(*models)
  models.each do |klass|
    if klass.respond_to?(:acts_as_archive?) && klass.acts_as_archive?
      time = Benchmark.measure do
        klass.create_archive_table
        klass.migrate_from_acts_as_paranoid
        klass.create_archive_indexes
      end
      $stdout.puts "-- ActsAsArchive.update(#{models.join(', ')})"
      $stdout.puts "   -> #{"%.4fs" % time.real}"
    end
  end
end