spatial_features 2.7.1 → 2.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67375fd4d6b858c5ec8328bd8aaa32c71941d8766191930548c92c85c0956b98
4
- data.tar.gz: b218f666a84ef5d134871fba0b601ee9670878e7bdca9ee6836333e1d00f1a27
3
+ metadata.gz: 4b6abe862ed5f56fddc3c661c0f07441d9688203396289bb106a103b9d0d60ef
4
+ data.tar.gz: c1962522d534ce23508a6eab05742ea7ba427415f0b662ab0a0f202b7f81d084
5
5
  SHA512:
6
- metadata.gz: 6bd79356822d20f5b760170af7e7503f7804ada6806496e41659a1fa8053fe0b9abdbc561720528410521ce7612a35b29958937bb15601c58de66c22d4877db6
7
- data.tar.gz: 13a0194979498974b8c4c0607c2333942fab881e583a2a6e2d3e6bef631517e156171e2654559a8a21ef69061a6f0adb5ecd62846d2e85b1a64487f8b25a42f1
6
+ metadata.gz: f13503272dbd7d176ec814aae1b09e353f175370be2a26a069d595bdef141ef80ea2bd6c489026b4add5311f0cd81582f75633ddd3bcb1ad813fae840a21ab9b
7
+ data.tar.gz: 2ebcb0781feb12c6058043d55fa57b06a7a7b3edb98837c8a047c8fa8abb133be5a2a82e78a2cf83a38c9b47e9c76eb21a90da1cdc9cdd7f601edf5ab9c2a01d
@@ -3,7 +3,7 @@ class SpatialCache < ActiveRecord::Base
3
3
 
4
4
  def self.between(spatial_model, klass)
5
5
  where(SpatialFeatures::Utils.polymorphic_condition(spatial_model, 'spatial_model'))
6
- .where(SpatialFeatures::Utils.polymorphic_condition(klass, 'intersection_model'))
6
+ .where(:intersection_model_type => klass.to_s)
7
7
  end
8
8
 
9
9
  def stale?
@@ -59,7 +59,7 @@ module SpatialFeatures
59
59
  end
60
60
 
61
61
  def self.clear_record_cache(record, klass)
62
- record.spatial_caches.where(:intersection_model_type => klass).delete_all
62
+ record.spatial_caches.where(:intersection_model_type => klass.to_s).delete_all
63
63
  SpatialProximity.between(record, klass).delete_all
64
64
  end
65
65
 
@@ -72,7 +72,7 @@ module SpatialFeatures
72
72
  end
73
73
 
74
74
  def features
75
- type = base_class # Rails stores polymorphic foreign keys as the base class
75
+ type = base_class.to_s # Rails stores polymorphic foreign keys as the base class
76
76
  if all == unscoped
77
77
  Feature.where(:spatial_model_type => type)
78
78
  else
@@ -100,7 +100,9 @@ module SpatialFeatures
100
100
  options = options.reverse_merge(:columns => "#{table_name}.*")
101
101
 
102
102
  # Don't use the cache if it doesn't exist
103
- return none.extending(UncachedResult) unless other.spatial_cache_for?(Utils.class_of(self), buffer_in_meters)
103
+ unless other.class.unscoped { other.spatial_cache_for?(Utils.class_of(self), buffer_in_meters) } # Unscope so if we're checking for same class intersections the scope doesn't affect this lookup
104
+ return none.extending(UncachedResult)
105
+ end
104
106
 
105
107
  scope = cached_spatial_join(other)
106
108
  scope = scope.select(options[:columns])
@@ -113,8 +115,6 @@ module SpatialFeatures
113
115
  def cached_spatial_join(other)
114
116
  other_class = Utils.class_of(other)
115
117
 
116
- raise "Cannot use cached spatial join for the same class" if self == other_class
117
-
118
118
  other_column = other_class.name < self.name ? :model_a : :model_b
119
119
  self_column = other_column == :model_a ? :model_b : :model_a
120
120
 
@@ -1,3 +1,3 @@
1
1
  module SpatialFeatures
2
- VERSION = "2.7.1"
2
+ VERSION = "2.7.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spatial_features
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Wallace
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-02 00:00:00.000000000 Z
12
+ date: 2019-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -18,9 +18,9 @@ dependencies:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '4.2'
21
- - - "<"
21
+ - - "<="
22
22
  - !ruby/object:Gem::Version
23
- version: '6.0'
23
+ version: '5.1'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
@@ -28,9 +28,9 @@ dependencies:
28
28
  - - ">="
29
29
  - !ruby/object:Gem::Version
30
30
  version: '4.2'
31
- - - "<"
31
+ - - "<="
32
32
  - !ruby/object:Gem::Version
33
- version: '6.0'
33
+ version: '5.1'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: delayed_job_active_record
36
36
  requirement: !ruby/object:Gem::Requirement