Sha256: 2cef2635444876f3b94e7be774e31f2363d98d54827b732246c71474369ea0e8
Contents?: true
Size: 769 Bytes
Versions: 6
Compression:
Stored size: 769 Bytes
Contents
module ActsAsArchive module Base def self.included(base) base.extend ActMethods end module ActMethods def acts_as_archive(options={}) class_eval <<-end_eval def self.acts_as_archive? self.to_s == #{self.to_s.inspect} end def self.archive_indexes #{Array(options[:indexes]).map{|index| index.is_a?(Array) ? index.map(&:to_sym) : index.to_sym}.inspect} end class Archive < ActiveRecord::Base self.record_timestamps = false self.table_name = "archived_#{self.table_name}" end end_eval include Destroy include Restore include Table end end end end
Version data entries
6 entries across 6 versions & 2 rubygems