aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorJoel Schneider <joel.schneider@webascender.com>2019-07-12 14:49:03 -0400
committerJoel Schneider <joel.schneider@webascender.com>2019-07-12 14:49:03 -0400
commitddd0e9b02614d57aa3876b5679f046eca13b10d4 (patch)
treeceaad7852d1b4099cf68b4b38eb308307de73952 /activerecord/lib
parent727da1d8cdcab3ff50e399053faf7ba84e05ce03 (diff)
downloadrails-ddd0e9b02614d57aa3876b5679f046eca13b10d4.tar.gz
rails-ddd0e9b02614d57aa3876b5679f046eca13b10d4.tar.bz2
rails-ddd0e9b02614d57aa3876b5679f046eca13b10d4.zip
Make currency symbols optional for money column type in PostgreSQL
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb
index 6434377b57..357493dfc0 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/money.rb
@@ -26,9 +26,9 @@ module ActiveRecord
value = value.sub(/^\((.+)\)$/, '-\1') # (4)
case value
- when /^-?\D+[\d,]+\.\d{2}$/ # (1)
+ when /^-?\D*[\d,]+\.\d{2}$/ # (1)
value.gsub!(/[^-\d.]/, "")
- when /^-?\D+[\d.]+,\d{2}$/ # (2)
+ when /^-?\D*[\d.]+,\d{2}$/ # (2)
value.gsub!(/[^-\d,]/, "").sub!(/,/, ".")
end