postgis_adapter 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,8 +18,11 @@ require 'postgis_adapter/acts_as_geom'
18
18
  include GeoRuby::SimpleFeatures
19
19
  include SpatialAdapter
20
20
 
21
+ module PostgisAdapter
22
+ IGNORE_TABLES = %w{ spatial_ref_sys geometry_columns geography_columns }
23
+ end
21
24
  #tables to ignore in migration : relative to PostGIS management of geometric columns
22
- ActiveRecord::SchemaDumper.ignore_tables.concat %w{ spatial_ref_sys geometry_columns geography_columns }
25
+ ActiveRecord::SchemaDumper.ignore_tables.concat PostgisAdapter::IGNORE_TABLES
23
26
 
24
27
  #add a method to_yaml to the Geometry class which will transform a geometry in a form suitable to be used in a YAML file (such as in a fixture)
25
28
  GeoRuby::SimpleFeatures::Geometry.class_eval do
@@ -270,15 +273,14 @@ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
270
273
  end
271
274
 
272
275
  # For version of Rails where exists disable_referential_integrity
273
- if self.instance_methods.include? "disable_referential_integrity"
276
+ if self.instance_methods.include? :disable_referential_integrity
274
277
  #Pete Deffendol's patch
275
278
  alias :original_disable_referential_integrity :disable_referential_integrity
276
279
  def disable_referential_integrity(&block) #:nodoc:
277
- ignore_tables = %w{ geometry_columns spatial_ref_sys } # geography_columns + views
278
- execute(tables.select { |name| !ignore_tables.include?(name) }.map { |name| "ALTER TABLE #{quote_table_name(name)} DISABLE TRIGGER ALL" }.join(";"))
280
+ execute(tables.reject { |name| PostgisAdapter::IGNORE_TABLES.include?(name) }.map { |name| "ALTER TABLE #{quote_table_name(name)} DISABLE TRIGGER ALL" }.join(";"))
279
281
  yield
280
282
  ensure
281
- execute(tables.select { |name| !ignore_tables.include?(name)}.map { |name| "ALTER TABLE #{quote_table_name(name)} ENABLE TRIGGER ALL" }.join(";"))
283
+ execute(tables.reject { |name| PostgisAdapter::IGNORE_TABLES.include?(name) }.map { |name| "ALTER TABLE #{quote_table_name(name)} ENABLE TRIGGER ALL" }.join(";"))
282
284
  end
283
285
  end
284
286
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'postgis_adapter'
3
- spec.version = '0.8.0'
3
+ spec.version = '0.8.1'
4
4
  spec.authors = ['Marcos Piccinini']
5
5
  spec.summary = 'PostGIS Adapter for Active Record'
6
6
  spec.email = 'x@nofxx.com'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: postgis_adapter
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.8.0
5
+ version: 0.8.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Marcos Piccinini
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-03-08 00:00:00 -03:00
13
+ date: 2011-03-18 00:00:00 -03:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency