Module: ActiverecordHoarder::Restore::ClassMethods

Defined in:
lib/activerecord_hoarder/restore.rb

Instance Method Summary collapse

Instance Method Details

#restore_archive_records(date) ⇒ Object



8
9
10
11
12
13
# File 'lib/activerecord_hoarder/restore.rb', line 8

def restore_archive_records(date)
  storage = ::ActiverecordHoarder::Storage.new(self.table_name)
  key = ::ActiverecordHoarder::StorageKey.from_date(date, :json)
  dataIO = storage.fetch_data(key)
  create(JSON.parse(dataIO.read))
end