diff options
author | Martin Schùˆrrer <martin@schuerrer.org> | 2013-03-25 19:41:09 +0100 |
---|---|---|
committer | Martin Schùˆrrer <martin@schuerrer.org> | 2013-03-25 19:41:09 +0100 |
commit | f8675eb064e5aa052da7a5b9b5d3aa390822bf47 (patch) | |
tree | baf3e92717bbd0f0fe3fa7d68ab5a82e3e95a295 | |
parent | 336b376728dad778b2cf5245ea3cde242e94530f (diff) | |
download | rails-f8675eb064e5aa052da7a5b9b5d3aa390822bf47.tar.gz rails-f8675eb064e5aa052da7a5b9b5d3aa390822bf47.tar.bz2 rails-f8675eb064e5aa052da7a5b9b5d3aa390822bf47.zip |
Move away from column.sql_type in untested code too
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index 6329733abc..61e5e76f83 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -83,9 +83,10 @@ module ActiveRecord def type_cast(value, column, array_member = false) return super(value, column) unless column + sql_type = type_to_sql(column.type, column.limit, column.precision, column.scale) case value when Range - return super(value, column) unless /range$/ =~ column.sql_type + return super(value, column) unless /range$/ =~ sql_type PostgreSQLColumn.range_to_string(value) when NilClass if column.array && array_member @@ -96,23 +97,23 @@ module ActiveRecord super(value, column) end when Array - case column.sql_type + case sql_type when 'point' then PostgreSQLColumn.point_to_string(value) else return super(value, column) unless column.array PostgreSQLColumn.array_to_string(value, column, self) end when String - return super(value, column) unless 'bytea' == column.sql_type + return super(value, column) unless 'bytea' == sql_type { :value => value, :format => 1 } when Hash - case column.sql_type + case sql_type when 'hstore' then PostgreSQLColumn.hstore_to_string(value) when 'json' then PostgreSQLColumn.json_to_string(value) else super(value, column) end when IPAddr - return super(value, column) unless ['inet','cidr'].include? column.sql_type + return super(value, column) unless ['inet','cidr'].include? sql_type PostgreSQLColumn.cidr_to_string(value) else super(value, column) |