From 068e5cb776a4997ae9df32f1d548d9565afdd47a Mon Sep 17 00:00:00 2001 From: viehlieb Date: Tue, 7 Feb 2023 17:05:16 +0100 Subject: [PATCH] adapt localize input to remove ',' separator and replace with '.' --- app/models/concerns/localize_input.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/concerns/localize_input.rb b/app/models/concerns/localize_input.rb index cfb44a44..b6330fcc 100644 --- a/app/models/concerns/localize_input.rb +++ b/app/models/concerns/localize_input.rb @@ -8,7 +8,7 @@ module LocalizeInput separator = I18n.t("separator", scope: "number.format") delimiter = I18n.t("delimiter", scope: "number.format") input.gsub!(delimiter, "") if input.match(/\d+#{Regexp.escape(delimiter)}+\d+#{Regexp.escape(separator)}+\d+/) # Remove delimiter - input.gsub!(separator, ".") # Replace separator with db compatible character + input.gsub!(separator, ".") or input.gsub!(",", ".") # Replace separator with db compatible character input rescue Rails.logger.warn "Can't localize input: #{input}"