lib/postgis_adapter.rb in postgis_adapter-0.7.7 vs lib/postgis_adapter.rb in postgis_adapter-0.7.8
- old
+ new
@@ -247,21 +247,21 @@
end
end
end
# # For version of Rails where exists disable_referential_integrity
-# if self.instance_methods.include? "disable_referential_integrity"
-# #Pete Deffendol's patch
-# alias :original_disable_referential_integrity :disable_referential_integrity
-# def disable_referential_integrity(&block) #:nodoc:
-# ignore_tables = %w{ geometry_columns spatial_ref_sys }
-# execute(tables.select { |name| !ignore_tables.include?(name) }.collect { |name| "ALTER TABLE #{quote_table_name(name)} DISABLE TRIGGER ALL" }.join(";"))
-# yield
-# ensure
-# execute(tables.select { |name| !ignore_tables.include?(name)}.collect { |name| "ALTER TABLE #{quote_table_name(name)} ENABLE TRIGGER ALL" }.join(";"))
-# end
-# end
+ if self.instance_methods.include? "disable_referential_integrity"
+ #Pete Deffendol's patch
+ alias :original_disable_referential_integrity :disable_referential_integrity
+ def disable_referential_integrity(&block) #:nodoc:
+ ignore_tables = %w{ geometry_columns spatial_ref_sys geography_columns }
+ execute(tables.select { |name| !ignore_tables.include?(name) }.collect { |name| "ALTER TABLE #{quote_table_name(name)} DISABLE TRIGGER ALL" }.join(";"))
+ yield
+ ensure
+ execute(tables.select { |name| !ignore_tables.include?(name)}.collect { |name| "ALTER TABLE #{quote_table_name(name)} ENABLE TRIGGER ALL" }.join(";"))
+ end
+ end
private
def column_spatial_info(table_name)
constr = query <<-end_sql
@@ -397,19 +397,19 @@
end
end
end
-#Would prefer creation of a PostgreSQLColumn type instead but I would
+# Would prefer creation of a PostgreSQLColumn type instead but I would
# need to reimplement methods where Column objects are instantiated so
# I leave it like this
module ActiveRecord
module ConnectionAdapters
class SpatialPostgreSQLColumn < Column
include SpatialColumn
- #Transforms a string to a geometry. PostGIS returns a HewEWKB string.
+ #Transforms a string to a geometry. PostGIS returns a HexEWKB string.
def self.string_to_geometry(string)
return string unless string.is_a?(String)
GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(string) rescue nil
end