demarches-normaliennes/app/lib/recovery/revision_exporter.rb
2023-05-19 11:19:15 +02:00

17 lines
465 B
Ruby

module Recovery
class RevisionExporter
FILE_PATH = Rails.root.join('lib', 'data', 'revision', 'export.dump')
attr_reader :revisions, :file_path
def initialize(revision_ids:, file_path: FILE_PATH)
@revisions = ProcedureRevision.where(id: revision_ids)
.preload(revision_types_de_champ: :type_de_champ)
.to_a
@file_path = file_path
end
def dump
@file_path.binwrite(Marshal.dump(@revisions))
end
end
end