activerecord-spatial 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZjAzZDUyMTZiZmRkY2YxNTE2YjQ0NTk4M2NmYTdjZTUxNDljY2MzMQ==
5
+ data.tar.gz: !binary |-
6
+ ZTc1ZmM5N2Q2ZDdkNTk5NmQzODBiN2JlZmExM2IzMzBjMmIwMjA4Yw==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YzkxMGI3OWU3OGMxZjI1ZDA4MDQ1Zjg5ZjdjYjNlNzhmOGY0ODE5OGFmMjdh
10
+ MjEwMWEyNDcwZDBkYzAxMDIxZDgzMDBjYjgyMzBjYzljYzliMWI1NzlkYTMy
11
+ OWFhOGZiNzNkNmRjYTc2NTBjMjE0YjUwODA2OGFkNjJkNTg3ODE=
12
+ data.tar.gz: !binary |-
13
+ ZTY0OGIwZGE1YTk4NmE0MzhkYjE2ZGU2YWM3YjZmZjM0ZGUzYWJiNTExNGYy
14
+ OWFjN2EzYzU0NWI0NWY5YjUyNTc5MTIzMzJhMGY0NWE0NTUyMDkyOTZjMzM0
15
+ ZGY1NjI4MjFlMjNjZDdhNGQxMWE1YTQ3MjY0NDQ0ODZiNWJmY2M=
data/README.rdoc CHANGED
@@ -116,6 +116,16 @@ you to use the actual Geos extensions in an unfettered way. If you wish to
116
116
  use the spatial extensions with versions of Rails prior to 3, see versions of
117
117
  the geos-extensions gem prior to version 0.3.0 where the split occured.
118
118
 
119
+ === Note About ActiveRecord 4.0.0
120
+
121
+ Rails 4.0.0 introducted a backwards incompatible change involving `order`
122
+ scopes where `ORDER BY` would be added in the opposite order compared to
123
+ previous versions of Rails. This change was reverted in Rails 4.0.1. Because
124
+ the change only lasted for a single version, we have decided that we will
125
+ not be supporting Rails 4.0.0 and will only support versions of Rails that
126
+ feature `order` scopes that are consistent with the behaviour prior to Rails
127
+ 4.0.0. This includes Rails 4.0.1 and above.
128
+
119
129
  == PostGIS and PostgreSQL Versions Supported
120
130
 
121
131
  As of this writing, things look good for PostgreSQL 9.1 and 9.2 for both
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.description = "ActiveRecord Spatial gives AR the ability to work with PostGIS columns."
12
12
  s.summary = s.description
13
13
  s.email = "code@zoocasa.com"
14
+ s.license = "MIT"
14
15
  s.extra_rdoc_files = [
15
16
  "README.rdoc"
16
17
  ]
@@ -20,7 +21,7 @@ Gem::Specification.new do |s|
20
21
  s.homepage = "https://github.com/zoocasa/activerecord-spatial"
21
22
  s.require_paths = ["lib"]
22
23
 
23
- s.add_dependency("rails", [">= 3.2"])
24
+ s.add_dependency("rails", [">= 3.2", "!= 4.0.0"])
24
25
  s.add_dependency("geos-extensions", [">= 0.3.0.dev"])
25
26
  end
26
27
 
@@ -1,5 +1,5 @@
1
1
 
2
2
  module ActiveRecordSpatial
3
- VERSION = '0.1.0'
3
+ VERSION = '0.2.0'
4
4
  end
5
5
 
@@ -667,7 +667,7 @@ class BothGeomWrapperAndOptionsWithMixedSRIDsTest < ActiveRecordSpatialTestCase
667
667
  }
668
668
  end
669
669
 
670
- assert_sql(/ORDER BY "bars".id/) do
670
+ assert_sql(/ORDER BY "bars"."id"/) do
671
671
  Foo.first.bars.to_a
672
672
  end
673
673
  end
@@ -66,15 +66,15 @@ class SpatialScopesGeographiesTests < ActiveRecordSpatialTestCase
66
66
  end
67
67
 
68
68
  def test_order_by_st_area
69
- assert_equal([1, 2, 3], apply_id_order_scope(FooGeography.order_by_st_area).to_a.collect(&:id))
69
+ assert_equal([1, 2, 3], FooGeography.order_by_st_area.to_a.collect(&:id))
70
70
  end
71
71
 
72
72
  def test_order_by_st_area_desc
73
- assert_equal([3, 1, 2], apply_id_order_scope(FooGeography.order_by_st_area(:desc => true)).to_a.collect(&:id))
73
+ assert_equal([3, 1, 2], FooGeography.order_by_st_area(:desc => true).to_a.collect(&:id))
74
74
  end
75
75
 
76
76
  def test_order_by_st_length
77
- assert_equal([1, 2, 3], apply_id_order_scope(FooGeography.order_by_st_length).to_a.collect(&:id))
77
+ assert_equal([1, 2, 3], FooGeography.order_by_st_length.to_a.collect(&:id))
78
78
  end
79
79
 
80
80
  def test_order_by_st_length_desc
@@ -84,23 +84,23 @@ class SpatialScopesGeographiesTests < ActiveRecordSpatialTestCase
84
84
  [3, 1, 2]
85
85
  end
86
86
 
87
- assert_equal(expected, apply_id_order_scope(FooGeography.order_by_st_length(:desc => true)).where('true = true').to_a.collect(&:id))
87
+ assert_equal(expected, FooGeography.order_by_st_length(:desc => true).where('true = true').to_a.collect(&:id))
88
88
  end
89
89
 
90
90
  def test_order_by_st_perimeter
91
91
  skip('requires PostGIS 2+') unless FooGeography.respond_to?(:order_by_st_perimeter)
92
92
 
93
- assert_equal([1, 2, 3], apply_id_order_scope(FooGeography.order_by_st_perimeter).to_a.collect(&:id))
93
+ assert_equal([1, 2, 3], FooGeography.order_by_st_perimeter.to_a.collect(&:id))
94
94
  end
95
95
 
96
96
  def test_order_by_st_perimeter_desc
97
97
  skip('requires PostGIS 2+') unless FooGeography.respond_to?(:order_by_st_perimeter)
98
98
 
99
- assert_equal([3, 1, 2], apply_id_order_scope(FooGeography.order_by_st_perimeter(:desc => true)).to_a.collect(&:id))
99
+ assert_equal([3, 1, 2], FooGeography.order_by_st_perimeter(:desc => true).to_a.collect(&:id))
100
100
  end
101
101
 
102
102
  def test_order_by_st_area_with_desc_symbol
103
- assert_equal([3, 1, 2], apply_id_order_scope(FooGeography.order_by_st_area(:desc)).to_a.collect(&:id))
103
+ assert_equal([3, 1, 2], FooGeography.order_by_st_area(:desc).to_a.collect(&:id))
104
104
  end
105
105
  end
106
106
 
@@ -130,59 +130,59 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
130
130
  end
131
131
 
132
132
  def test_order_by_st_area
133
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_area).to_a.collect(&:id))
133
+ assert_equal([1, 2, 3], Foo.order_by_st_area.to_a.collect(&:id))
134
134
  end
135
135
 
136
136
  def test_order_by_st_area_desc
137
- assert_equal([3, 1, 2], apply_id_order_scope(Foo.order_by_st_area(:desc => true)).to_a.collect(&:id))
137
+ assert_equal([3, 1, 2], Foo.order_by_st_area(:desc => true).to_a.collect(&:id))
138
138
  end
139
139
 
140
140
  def test_order_by_st_ndims
141
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_ndims).to_a.collect(&:id))
141
+ assert_equal([1, 2, 3], Foo.order_by_st_ndims.to_a.collect(&:id))
142
142
  end
143
143
 
144
144
  def test_order_by_st_ndims_desc
145
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_ndims(:desc => true)).to_a.collect(&:id))
145
+ assert_equal([1, 2, 3], Foo.order_by_st_ndims(:desc => true).to_a.collect(&:id))
146
146
  end
147
147
 
148
148
  def test_order_by_st_npoints
149
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_npoints).to_a.collect(&:id))
149
+ assert_equal([1, 2, 3], Foo.order_by_st_npoints.to_a.collect(&:id))
150
150
  end
151
151
 
152
152
  def test_order_by_st_npoints_desc
153
- assert_equal([3, 1, 2], apply_id_order_scope(Foo.order_by_st_npoints(:desc => true)).to_a.collect(&:id))
153
+ assert_equal([3, 1, 2], Foo.order_by_st_npoints(:desc => true).to_a.collect(&:id))
154
154
  end
155
155
 
156
156
  def test_order_by_st_nrings
157
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_nrings).to_a.collect(&:id))
157
+ assert_equal([1, 2, 3], Foo.order_by_st_nrings.to_a.collect(&:id))
158
158
  end
159
159
 
160
160
  def test_order_by_st_nrings_desc
161
- assert_equal([3, 1, 2], apply_id_order_scope(Foo.order_by_st_nrings(:desc => true)).to_a.collect(&:id))
161
+ assert_equal([3, 1, 2], Foo.order_by_st_nrings(:desc => true).to_a.collect(&:id))
162
162
  end
163
163
 
164
164
  def test_order_by_st_numgeometries
165
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_numgeometries).to_a.collect(&:id))
165
+ assert_equal([1, 2, 3], Foo.order_by_st_numgeometries.to_a.collect(&:id))
166
166
  end
167
167
 
168
168
  def test_order_by_st_numgeometries_desc
169
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_numgeometries(:desc => true)).to_a.collect(&:id))
169
+ assert_equal([1, 2, 3], Foo.order_by_st_numgeometries(:desc => true).to_a.collect(&:id))
170
170
  end
171
171
 
172
172
  def test_order_by_st_numinteriorring
173
- assert_equal([3, 1, 2], apply_id_order_scope(Foo.order_by_st_numinteriorring).to_a.collect(&:id))
173
+ assert_equal([3, 1, 2], Foo.order_by_st_numinteriorring.to_a.collect(&:id))
174
174
  end
175
175
 
176
176
  def test_order_by_st_numinteriorring_desc
177
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_numinteriorring(:desc => true)).to_a.collect(&:id))
177
+ assert_equal([1, 2, 3], Foo.order_by_st_numinteriorring(:desc => true).to_a.collect(&:id))
178
178
  end
179
179
 
180
180
  def test_order_by_st_numinteriorrings
181
- assert_equal([3, 1, 2], apply_id_order_scope(Foo.order_by_st_numinteriorrings).to_a.collect(&:id))
181
+ assert_equal([3, 1, 2], Foo.order_by_st_numinteriorrings.to_a.collect(&:id))
182
182
  end
183
183
 
184
184
  def test_order_by_st_numinteriorrings_desc
185
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_numinteriorrings(:desc => true)).to_a.collect(&:id))
185
+ assert_equal([1, 2, 3], Foo.order_by_st_numinteriorrings(:desc => true).to_a.collect(&:id))
186
186
  end
187
187
 
188
188
  def test_order_by_st_numpoints
@@ -190,7 +190,7 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
190
190
  end
191
191
 
192
192
  def test_order_by_st_numpoints_desc
193
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_numpoints(:desc => true)).to_a.collect(&:id))
193
+ assert_equal([1, 2, 3], Foo.order_by_st_numpoints(:desc => true).to_a.collect(&:id))
194
194
  end
195
195
 
196
196
  def test_order_by_st_length3d
@@ -198,15 +198,15 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
198
198
  end
199
199
 
200
200
  def test_order_by_st_length3d_desc
201
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_length3d(:desc => true)).to_a.collect(&:id))
201
+ assert_equal([1, 2, 3], Foo.order_by_st_length3d(:desc => true).to_a.collect(&:id))
202
202
  end
203
203
 
204
204
  def test_order_by_st_length
205
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_length).to_a.collect(&:id))
205
+ assert_equal([1, 2, 3], Foo.order_by_st_length.to_a.collect(&:id))
206
206
  end
207
207
 
208
208
  def test_order_by_st_length_desc
209
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_length(:desc => true)).to_a.collect(&:id))
209
+ assert_equal([1, 2, 3], Foo.order_by_st_length(:desc => true).to_a.collect(&:id))
210
210
  end
211
211
 
212
212
  def test_order_by_st_length2d
@@ -214,11 +214,11 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
214
214
  end
215
215
 
216
216
  def test_order_by_st_length2d_desc
217
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_length2d(:desc => true)).to_a.collect(&:id))
217
+ assert_equal([1, 2, 3], Foo.order_by_st_length2d(:desc => true).to_a.collect(&:id))
218
218
  end
219
219
 
220
220
  def test_order_by_st_length3d_spheroid
221
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_length3d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]')).to_a.collect(&:id))
221
+ assert_equal([1, 2, 3], Foo.order_by_st_length3d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]').to_a.collect(&:id))
222
222
  end
223
223
 
224
224
  def test_order_by_st_length3d_spheroid_desc
@@ -228,19 +228,19 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
228
228
  [1, 2, 3]
229
229
  end
230
230
 
231
- assert_equal(expected, apply_id_order_scope(Foo.order_by_st_length3d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true)).to_a.collect(&:id))
231
+ assert_equal(expected, Foo.order_by_st_length3d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true).to_a.collect(&:id))
232
232
  end
233
233
 
234
234
  def test_order_by_st_length2d_spheroid
235
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_length2d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]')).to_a.collect(&:id))
235
+ assert_equal([1, 2, 3], Foo.order_by_st_length2d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]').to_a.collect(&:id))
236
236
  end
237
237
 
238
238
  def test_order_by_st_length2d_spheroid_desc
239
- assert_equal([3, 1, 2], apply_id_order_scope(Foo.order_by_st_length2d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true)).to_a.collect(&:id))
239
+ assert_equal([3, 1, 2], Foo.order_by_st_length2d_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true).to_a.collect(&:id))
240
240
  end
241
241
 
242
242
  def test_order_by_st_length_spheroid
243
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_length_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]')).to_a.collect(&:id))
243
+ assert_equal([1, 2, 3], Foo.order_by_st_length_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]').to_a.collect(&:id))
244
244
  end
245
245
 
246
246
  def test_order_by_st_length_spheroid_desc
@@ -250,23 +250,23 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
250
250
  [1, 2, 3]
251
251
  end
252
252
 
253
- assert_equal(expected, apply_id_order_scope(Foo.order_by_st_length_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true)).to_a.collect(&:id))
253
+ assert_equal(expected, Foo.order_by_st_length_spheroid('SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true).to_a.collect(&:id))
254
254
  end
255
255
 
256
256
  def test_order_by_st_perimeter
257
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_perimeter).to_a.collect(&:id))
257
+ assert_equal([1, 2, 3], Foo.order_by_st_perimeter.to_a.collect(&:id))
258
258
  end
259
259
 
260
260
  def test_order_by_st_perimeter_desc
261
- assert_equal([3, 1, 2], apply_id_order_scope(Foo.order_by_st_perimeter(:desc => true)).to_a.collect(&:id))
261
+ assert_equal([3, 1, 2], Foo.order_by_st_perimeter(:desc => true).to_a.collect(&:id))
262
262
  end
263
263
 
264
264
  def test_order_by_st_perimeter2d
265
- assert_equal([1, 2, 3], apply_id_order_scope(Foo.order_by_st_perimeter2d).to_a.collect(&:id))
265
+ assert_equal([1, 2, 3], Foo.order_by_st_perimeter2d.to_a.collect(&:id))
266
266
  end
267
267
 
268
268
  def test_order_by_st_perimeter2d_desc
269
- assert_equal([3, 1, 2], apply_id_order_scope(Foo.order_by_st_perimeter2d(:desc => true)).to_a.collect(&:id))
269
+ assert_equal([3, 1, 2], Foo.order_by_st_perimeter2d(:desc => true).to_a.collect(&:id))
270
270
  end
271
271
 
272
272
  def test_order_by_st_perimeter3d
@@ -274,7 +274,7 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
274
274
  end
275
275
 
276
276
  def test_order_by_st_perimeter3d_desc
277
- assert_equal([3, 1, 2], apply_id_order_scope(Foo.order_by_st_perimeter3d(:desc => true)).to_a.collect(&:id))
277
+ assert_equal([3, 1, 2], Foo.order_by_st_perimeter3d(:desc => true).to_a.collect(&:id))
278
278
  end
279
279
 
280
280
  def test_order_by_st_hausdorffdistance
@@ -290,15 +290,15 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
290
290
  end
291
291
 
292
292
  def test_order_by_st_distance_spheroid
293
- assert_equal([2, 3, 1], apply_id_order_scope(Foo.order_by_st_distance_spheroid('POINT(10 10)', 'SPHEROID["WGS 84", 6378137, 298.257223563]')).to_a.collect(&:id))
293
+ assert_equal([2, 3, 1], Foo.order_by_st_distance_spheroid('POINT(10 10)', 'SPHEROID["WGS 84", 6378137, 298.257223563]').to_a.collect(&:id))
294
294
  end
295
295
 
296
296
  def test_order_by_st_distance_spheroid_desc
297
- assert_equal([1, 3, 2], apply_id_order_scope(Foo.order_by_st_distance_spheroid('POINT(10 10)', 'SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true)).to_a.collect(&:id))
297
+ assert_equal([1, 3, 2], Foo.order_by_st_distance_spheroid('POINT(10 10)', 'SPHEROID["WGS 84", 6378137, 298.257223563]', :desc => true).to_a.collect(&:id))
298
298
  end
299
299
 
300
300
  def test_order_by_st_area_with_desc_symbol
301
- assert_equal([3, 1, 2], apply_id_order_scope(Foo.order_by_st_area(:desc)).to_a.collect(&:id))
301
+ assert_equal([3, 1, 2], Foo.order_by_st_area(:desc).to_a.collect(&:id))
302
302
  end
303
303
 
304
304
  def test_3dintersects
@@ -310,13 +310,13 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
310
310
  def test_3ddistance
311
311
  skip('ST_3ddistance is unavailable') unless Foo3d.respond_to?(:order_by_st_3ddistance)
312
312
 
313
- assert_equal([3, 2, 1], apply_id_order_scope(Foo3d.order_by_st_3ddistance('POINT(10 10)')).to_a.collect(&:id))
313
+ assert_equal([3, 2, 1], Foo3d.order_by_st_3ddistance('POINT(10 10)').to_a.collect(&:id))
314
314
  end
315
315
 
316
316
  def test_3dmaxdistance
317
317
  skip('ST_3dmaxdistance is unavailable') unless Foo3d.respond_to?(:order_by_st_3dmaxdistance)
318
318
 
319
- assert_equal([2, 1, 3], apply_id_order_scope(Foo3d.order_by_st_3dmaxdistance('POINT(10 10)')).to_a.collect(&:id))
319
+ assert_equal([2, 1, 3], Foo3d.order_by_st_3dmaxdistance('POINT(10 10)').to_a.collect(&:id))
320
320
  end
321
321
 
322
322
  def test_3ddwithin
@@ -335,13 +335,13 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
335
335
  values = nil
336
336
 
337
337
  assert_sql(/ST_envelope\("foos"."the_geom"\)/) do
338
- values = apply_id_order_scope(Foo.
338
+ values = Foo.
339
339
  order_by_st_perimeter(
340
340
  :desc => true,
341
341
  :column => {
342
342
  :wrapper => :envelope
343
343
  }
344
- )).to_a.collect(&:id)
344
+ ).to_a.collect(&:id)
345
345
  end
346
346
 
347
347
  assert_equal([3, 1, 2], values)
@@ -351,7 +351,7 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
351
351
  values = nil
352
352
 
353
353
  assert_sql(/ST_geometryn\("foos"."the_geom", 1\)/) do
354
- values = apply_id_order_scope(Foo.
354
+ values = Foo.
355
355
  order_by_st_perimeter(
356
356
  :desc => true,
357
357
  :column => {
@@ -359,7 +359,7 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
359
359
  :geometryn => 1
360
360
  }
361
361
  }
362
- )).to_a.collect(&:id)
362
+ ).to_a.collect(&:id)
363
363
  end
364
364
 
365
365
  assert_equal([3, 1, 2], values)
@@ -369,7 +369,7 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
369
369
  values = nil
370
370
 
371
371
  assert_sql(/ST_snap\("foos"."the_geom", 'POINT \(0 0\)', 1.0\)/) do
372
- values = apply_id_order_scope(Foo.
372
+ values = Foo.
373
373
  order_by_st_perimeter(
374
374
  :desc => true,
375
375
  :column => {
@@ -380,7 +380,7 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
380
380
  ]
381
381
  }
382
382
  }
383
- )).to_a.collect(&:id)
383
+ ).to_a.collect(&:id)
384
384
  end
385
385
 
386
386
  assert_equal([3, 1, 2], values)
@@ -390,13 +390,13 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
390
390
  values = nil
391
391
 
392
392
  assert_sql(/ST_centroid\("foos"."the_geom"\)/) do
393
- values = apply_id_order_scope(Foo.
393
+ values = Foo.
394
394
  st_within(
395
395
  'POLYGON((-5 -5, 5 10, 20 20, 10 5, -5 -5))',
396
396
  :column => {
397
397
  :wrapper => :centroid
398
398
  }
399
- )).to_a.collect(&:id)
399
+ ).to_a.collect(&:id)
400
400
  end
401
401
 
402
402
  assert_equal([1, 2, 3], values)
@@ -406,7 +406,7 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
406
406
  values = nil
407
407
 
408
408
  assert_sql(/ST_geometryn\("foos"."the_geom", 1\)/) do
409
- values = apply_id_order_scope(Foo.
409
+ values = Foo.
410
410
  st_within(
411
411
  'POLYGON((-5 -5, 5 10, 20 20, 10 5, -5 -5))',
412
412
  :column => {
@@ -414,7 +414,7 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
414
414
  :geometryn => 1
415
415
  }
416
416
  }
417
- )).to_a.collect(&:id)
417
+ ).to_a.collect(&:id)
418
418
  end
419
419
 
420
420
  assert_equal([1, 2], values)
@@ -424,7 +424,7 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
424
424
  values = nil
425
425
 
426
426
  assert_sql(/ST_snap\("foos"."the_geom", 'POINT \(0 0\)', 1.0\)/) do
427
- values = apply_id_order_scope(Foo.
427
+ values = Foo.
428
428
  st_within(
429
429
  'POLYGON((-5 -5, 5 10, 20 20, 10 5, -5 -5))',
430
430
  :column => {
@@ -435,7 +435,7 @@ class SpatialScopesTests < ActiveRecordSpatialTestCase
435
435
  ]
436
436
  }
437
437
  }
438
- )).to_a.collect(&:id)
438
+ ).to_a.collect(&:id)
439
439
  end
440
440
 
441
441
  assert_equal([1, 2], values)
data/test/test_helper.rb CHANGED
@@ -220,16 +220,6 @@ class ActiveRecordSpatialTestCase < ActiveRecord::TestCase
220
220
  [ 0, 0 ]
221
221
  ], cs.to_a)
222
222
  end
223
-
224
- # Starting with Rails 4, `order` scopes are prepended to prior scopes, so
225
- # we need to account for both here.
226
- def apply_id_order_scope(scope)
227
- if ActiveRecord::VERSION::MAJOR >= 4
228
- scope.unscoped.order('id').merge(scope)
229
- else
230
- scope.order('id')
231
- end
232
- end
233
223
  end
234
224
 
235
225
  if !defined?(ActiveRecord::SQLCounter)
metadata CHANGED
@@ -1,44 +1,45 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-spatial
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.1.0
4
+ version: 0.2.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - J Smith
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-29 00:00:00.000000000 Z
11
+ date: 2013-11-04 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: rails
16
14
  type: :runtime
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
15
+ prerelease: false
16
+ name: rails
17
+ version_requirements: !ruby/object:Gem::Requirement
19
18
  requirements:
20
19
  - - ! '>='
21
20
  - !ruby/object:Gem::Version
22
21
  version: '3.2'
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
22
+ - - ! '!='
23
+ - !ruby/object:Gem::Version
24
+ version: 4.0.0
25
+ requirement: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.2'
30
+ - - ! '!='
31
+ - !ruby/object:Gem::Version
32
+ version: 4.0.0
30
33
  - !ruby/object:Gem::Dependency
31
- name: geos-extensions
32
34
  type: :runtime
33
- requirement: !ruby/object:Gem::Requirement
34
- none: false
35
+ prerelease: false
36
+ name: geos-extensions
37
+ version_requirements: !ruby/object:Gem::Requirement
35
38
  requirements:
36
39
  - - ! '>='
37
40
  - !ruby/object:Gem::Version
38
41
  version: 0.3.0.dev
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
+ requirement: !ruby/object:Gem::Requirement
42
43
  requirements:
43
44
  - - ! '>='
44
45
  - !ruby/object:Gem::Version
@@ -100,28 +101,28 @@ files:
100
101
  - test/spatial_scopes_tests.rb
101
102
  - test/test_helper.rb
102
103
  homepage: https://github.com/zoocasa/activerecord-spatial
103
- licenses: []
104
+ licenses:
105
+ - MIT
106
+ metadata: {}
104
107
  post_install_message:
105
108
  rdoc_options: []
106
109
  require_paths:
107
110
  - lib
108
111
  required_ruby_version: !ruby/object:Gem::Requirement
109
- none: false
110
112
  requirements:
111
113
  - - ! '>='
112
114
  - !ruby/object:Gem::Version
113
115
  version: '0'
114
116
  required_rubygems_version: !ruby/object:Gem::Requirement
115
- none: false
116
117
  requirements:
117
118
  - - ! '>='
118
119
  - !ruby/object:Gem::Version
119
120
  version: '0'
120
121
  requirements: []
121
122
  rubyforge_project:
122
- rubygems_version: 1.8.23
123
+ rubygems_version: 2.1.5
123
124
  signing_key:
124
- specification_version: 3
125
+ specification_version: 4
125
126
  summary: ActiveRecord Spatial gives AR the ability to work with PostGIS columns.
126
127
  test_files:
127
128
  - test/accessors_geographies_tests.rb