Module: Archiving::ArchiveTable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/archiving/archive_table.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#archive! ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/archiving/archive_table.rb', line 86 def archive! transaction do self.class.archive.new.tap do |archive| attributes.each { |k, v| archive[k] = v } raise "Unarchivable attributes" if archive.attributes != attributes archive.save!(validate: false) end archive_associations! delete end end |