diff options
author | Jon Leighton <j@jonathanleighton.com> | 2013-03-15 05:50:17 -0700 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2013-03-15 05:50:17 -0700 |
commit | 962604f424d635bfc068f3e754a0e69471657b03 (patch) | |
tree | 2cd5bce4128c7d7f89fa4871b3a4662e7e375f2f /activerecord/lib/active_record | |
parent | cd6a9f896704935736d6742ab181854873138bd0 (diff) | |
parent | aae89ee8607a802557b4877feb995204e0b58fed (diff) | |
download | rails-962604f424d635bfc068f3e754a0e69471657b03.tar.gz rails-962604f424d635bfc068f3e754a0e69471657b03.tar.bz2 rails-962604f424d635bfc068f3e754a0e69471657b03.zip |
Merge pull request #9686 from strzalek/cast_number_to_string_in_pg
Cast number to string in Postgres
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index 47e2e3928f..43f991b362 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -51,9 +51,12 @@ module ActiveRecord super end when Numeric - return super unless column.sql_type == 'money' - # Not truly string input, so doesn't require (or allow) escape string syntax. - "'#{value}'" + if column.sql_type == 'money' || [:string, :text].include?(column.type) + # Not truly string input, so doesn't require (or allow) escape string syntax. + "'#{value}'" + else + super + end when String case column.sql_type when 'bytea' then "'#{escape_bytea(value)}'" |