Skip to content

Commit

Permalink
TEMP
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-s-ccs committed Jan 11, 2024
1 parent 23694dc commit 6f1557f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/models/upload.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ def self.upload!(suppliers)

def self.all_or_none(transaction_class)
error = nil
# rubocop:disable Rails/Output
transaction_class.transaction do
puts "Transaction started: #{transaction_class}"
yield
puts "Transaction complete: #{transaction_class}"
rescue ActiveRecord::RecordInvalid => e
error = e
raise ActiveRecord::Rollback
end
# rubocop:enable Rails/Output
error
end
end

0 comments on commit 6f1557f

Please sign in to comment.