diff --git a/app/models/qc_file.rb b/app/models/qc_file.rb index cd95fa2582..c79d0fb1eb 100644 --- a/app/models/qc_file.rb +++ b/app/models/qc_file.rb @@ -13,16 +13,7 @@ def has_qc_files # rubocop:todo Metrics/MethodLength def add_qc_file(file, filename = nil) # rubocop:todo Metrics/MethodLength opts = { uploaded_data: { tempfile: file, filename: filename } } opts[:filename] = filename unless filename.nil? - if file.present? - original_filename = filename - instance = qc_files.new(opts) - instance.save - instance.update(filename: original_filename) - instance.reload - instance.update(filename: original_filename) - instance.reload - instance - end + qc_files.create!(opts) if file.present? end def update_qc_values_with_parser(_parser)