diff options
author | Joel Schneider <joel.schneider@webascender.com> | 2019-07-12 14:49:03 -0400 |
---|---|---|
committer | Joel Schneider <joel.schneider@webascender.com> | 2019-07-12 14:49:03 -0400 |
commit | ddd0e9b02614d57aa3876b5679f046eca13b10d4 (patch) | |
tree | ceaad7852d1b4099cf68b4b38eb308307de73952 /activerecord/lib | |
parent | 727da1d8cdcab3ff50e399053faf7ba84e05ce03 (diff) | |
download | rails-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.rb | 4 |
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 |