diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-25 16:00:16 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-25 16:01:46 -0300 |
commit | be71b0ecbe4b6f2416296dd0c120b652151ebcaa (patch) | |
tree | 8f07d21015975266bd96dc6081d45854ff131b6d /activerecord/lib/active_record | |
parent | c28b8ca766e3e7c6c43d3ae900c99f8377153c62 (diff) | |
download | rails-be71b0ecbe4b6f2416296dd0c120b652151ebcaa.tar.gz rails-be71b0ecbe4b6f2416296dd0c120b652151ebcaa.tar.bz2 rails-be71b0ecbe4b6f2416296dd0c120b652151ebcaa.zip |
The sql_type method called here is from
ActiveRecord::ConnectionAdapters::Column
See
https://github.com/rails/rails/blob/28b8ca766e3e7c6c43d3ae900c99f8377153c62/activerecord/lib/active_record/connection_adapters/column.rb#L16
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb index f587bf8140..cdf0cbe218 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/schema_dumper.rb @@ -5,7 +5,7 @@ module ActiveRecord # The goal of this module is to move Adapter specific column # definitions to the Adapter instead of having it in the schema # dumper itself. This code represents the normal case. - # We can then redefine how certain data types may be handled in the schema dumper on the + # We can then redefine how certain data types may be handled in the schema dumper on the # Adapter level by over-writing this code inside the database specific adapters module ColumnDumper def column_spec(column, types) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb index 61e5e76f83..635e60ad18 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/quoting.rb @@ -83,10 +83,9 @@ 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$/ =~ sql_type + return super(value, column) unless /range$/ =~ column.sql_type PostgreSQLColumn.range_to_string(value) when NilClass if column.array && array_member @@ -97,23 +96,23 @@ module ActiveRecord super(value, column) end when Array - case sql_type + case column.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' == sql_type + return super(value, column) unless 'bytea' == couln.sql_type { :value => value, :format => 1 } when Hash - case sql_type + case column.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? sql_type + return super(value, column) unless ['inet','cidr'].include? column.sql_type PostgreSQLColumn.cidr_to_string(value) else super(value, column) |