diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index ceb1adc..5e886a4 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -105,7 +105,7 @@ module ActiveRecord when 'interval' :string # Geometric types - when /^(?:point|line|lseg|box|"?path"?|polygon|circle)$/ + when /^(?:point|line|lseg|box|"?path"?|polygon|circle|geometry|geography)$/ :string # Network address types when /^(?:cidr|inet|macaddr)$/ diff --git a/activerecord/test/cases/column_definition_test.rb b/activerecord/test/cases/column_definition_test.rb index 8b6c019..d05961d 100644 --- a/activerecord/test/cases/column_definition_test.rb +++ b/activerecord/test/cases/column_definition_test.rb @@ -83,5 +83,15 @@ class ColumnDefinitionTest < ActiveRecord::TestCase uuid_column = ActiveRecord::ConnectionAdapters::PostgreSQLColumn.new('unique_id', nil, "uuid") assert_equal uuid_column.type, :string end + + def test_geometry_column_should_map_to_string + geometry_column = ActiveRecord::ConnectionAdapters::PostgreSQLColumn.new('the_geom', nil, "geometry") + assert_equal geometry_column.type, :string + end + + def test_geography_column_should_map_to_string + geography_column = ActiveRecord::ConnectionAdapters::PostgreSQLColumn.new('the_geog', nil, "geography") + assert_equal geography_column.type, :string + end end end