Skip to content

Commit

Permalink
Remove unsupported "no constraints" options
Browse files Browse the repository at this point in the history
See #117
  • Loading branch information
teeparham committed Nov 4, 2014
1 parent 0b1a656 commit abc2959
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ def initialize(factory_settings, table_name, name, default, cast_type, sql_type
@limit[:has_z] = true if @has_z
@limit[:has_m] = true if @has_m
@limit[:geographic] = true if @geographic
else
@limit = { no_constraints: true }
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,8 @@ def initialize(types, name, temporary, options, as, adapter)
def column(name, type, options = {})
if (info = @adapter.spatial_column_constructor(type.to_sym))
type = options[:type] || info[:type] || type
if type.to_s == 'geometry' && (options[:no_constraints] || options[:limit].is_a?(::Hash) && options[:limit][:no_constraints])
options.delete(:limit)
else
options[:type] = type
type = :spatial
end
options[:type] = type
type = :spatial
end
if type == :spatial
if (limit = options.delete(:limit))
Expand Down
23 changes: 0 additions & 23 deletions test/basic_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ def populate_ar_class(content)
klass.connection.create_table(:spatial_test) do |t|
t.column 'latlon', :point, :srid => 4326, :geographic => true
end
when :no_constraints
klass.connection.create_table(:spatial_test) do |t|
t.column 'geo', :geometry, :no_constraints => true
end
end
klass
end
Expand Down Expand Up @@ -143,25 +139,6 @@ def test_readme_example
assert_equal true, ::RGeo::Geos.is_geos?(object.shape)
end

# no_constraints no longer supported in PostGIS 2.0
def _test_save_and_load_no_constraints
klass = populate_ar_class(:no_constraints)
factory1_ = ::RGeo::Cartesian.preferred_factory(:srid => 3785)
factory2_ = ::RGeo::Cartesian.preferred_factory(:srid => 2000)
obj = klass.new
obj.geo = factory1_.point(1.0, 2.0)
obj.save!
id = obj.id
obj2 = klass.find(id)
assert_equal factory1_.point(1.0, 2.0), obj2.geo
assert_equal 3785, obj2.geo.srid
obj2.geo = factory2_.point(3.0, 4.0)
obj2.save!
obj3 = klass.find(id)
assert_equal factory2_.point(3.0, 4.0), obj3.geo
assert_equal 2000, obj3.geo.srid
end

def test_point_to_json
klass = populate_ar_class(:mercator_point)
obj = klass.new
Expand Down

0 comments on commit abc2959

Please sign in to comment.