Skip to content

Commit

Permalink
added check for status existing
Browse files Browse the repository at this point in the history
  • Loading branch information
beingmattlevy committed Aug 20, 2024
1 parent 4334981 commit 156e5df
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions db/data/20240806020511_payment_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ class PaymentStatus < ActiveRecord::Migration[7.1]
def up
matrix = { 'N' => 'new', 'P' => 'in_progress', 'R' => 'received', 'F' => 'refunded' }
Payment.find_each do |p|
p.status = matrix[p.old_status]
p.save!
unless p.status == matrix[p.old_status]
p.status = matrix[p.old_status]
p.save!
end
end
end

Expand Down

0 comments on commit 156e5df

Please sign in to comment.