Module: ColdStorage::Archivable
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/cold_storage/archivable.rb
Overview
Mixed into a model the first time it declares archivable.
Instance Method Summary collapse
-
#archive! ⇒ ColdStorage::Archiver::Result
Archives this single record (and its cascaded children).
-
#archived? ⇒ Boolean
Is there a row with this id in the archive database?.
Instance Method Details
#archive! ⇒ ColdStorage::Archiver::Result
Archives this single record (and its cascaded children).
101 102 103 104 |
# File 'lib/cold_storage/archivable.rb', line 101 def archive! relation = self.class.unscoped.where(self.class.primary_key => id) Archiver.new(self.class, relation: relation, force: true).call end |
#archived? ⇒ Boolean
Is there a row with this id in the archive database?
107 108 109 |
# File 'lib/cold_storage/archivable.rb', line 107 def archived? self.class.archive_model.where(self.class.primary_key => id).exists? end |