Replace gsub! with gsub so that strings are not modified

This commit is contained in:
Luis Ramos
2021-06-03 23:50:39 +01:00
parent 2b187c0547
commit c22799bda1

View File

@@ -56,8 +56,8 @@ module Spree
end
def set_last_digits
number.to_s.gsub!(/\s/, '')
verification_value.to_s.gsub!(/\s/, '')
number = @number.to_s.gsub(/\s/, '')
verification_value = verification_value.to_s.gsub(/\s/, '')
self.last_digits ||= number.to_s.length <= 4 ? number : number.to_s.slice(-4..-1)
end