diff --git a/lib/freedom_patches/active_record_base.rb b/lib/freedom_patches/active_record_base.rb index 4f71a4df380..39687ce2aa3 100644 --- a/lib/freedom_patches/active_record_base.rb +++ b/lib/freedom_patches/active_record_base.rb @@ -15,7 +15,7 @@ class ActiveRecord::Base def self.find_or_create_by_safe!(hash) begin find_or_create_by!(hash) - rescue PG::UniqueViolation, ActiveRecord::RecordNotUnique + rescue PG::UniqueViolation, ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid # try again cause another transaction could have passed by now find_or_create_by!(hash) end