spatial_features 2.7.5 → 2.7.6

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: 13dafdeb45681a5a529ee77c0c54d8306d35858e7c715c8f6845bf7bac4ff51e
4
- data.tar.gz: 9789d728e2a2fcd7cb3903637bb3fa61c01e323c99b38bf677fbfcdc06cc2bb4
3
+ metadata.gz: 5212c402e92554dacf5a96e9b0c37d7be41ae0d6e5a37f7979dec43fc2051c24
4
+ data.tar.gz: 3e74ccd3a3030d99063a1ab0b7e503c75c6c8f129b60d1f4259d116142094b18
5
5
  SHA512:
6
- metadata.gz: f0f614d22d3df5c3fbdeda0875d95b31b7a2b843ee012aafa240996a3ffe6ea00c1854b470945dcf3151ed3427daac680856c176b72419fad3f18dfa00418307
7
- data.tar.gz: e0b1535e925c8376fcfb20a13e70d1f1ae80dcfc7b709f755140aae94b70f8118dd95c7cd040d7f8441493d79d339e106838e3f757cac7eec2249023b0f7657c
6
+ metadata.gz: 19a54d24e4c472889d16fa92bdffd5d7f03d06f09d32e3484a0ce7bd558a80832b985fbfc6e1cfa7cc2ec861d31b7c7efdbbe923e12ae9df2122ccd69ac581c8
7
+ data.tar.gz: 4e4df3297bd72eb1694820f52b53ca13ba6a64a977dd5f43062c47f03e14d9c7c580bafadb1d3ab069d029eb9331ad113cdf8f1e6857a49e580b45a365a369ad
@@ -146,7 +146,9 @@ module SpatialFeatures
146
146
  scope = features_scope(self).select("#{geom} AS geom").select(:spatial_model_id)
147
147
 
148
148
  other_scope = features_scope(other)
149
- other_scope = other_scope.select("ST_Union(#{geom}) AS geom").select("ST_Buffer(ST_Union(#{geom}), #{buffer.to_i}) AS buffered_geom")
149
+ other_scope_select_sql = "ST_Union(#{geom})"
150
+ other_scope_select_sql = "ST_Buffer(#{other_scope_select_sql}, #{buffer})" if buffer&.positive?
151
+ other_scope = other_scope.select("ST_Union(#{geom}) AS geom").select("#{other_scope_select_sql} AS buffered_geom")
150
152
 
151
153
  return joins(%Q(INNER JOIN (#{scope.to_sql}) AS #{table_alias} ON #{table_alias}.spatial_model_id = #{table_name}.id))
152
154
  .joins(%Q(INNER JOIN (#{other_scope.to_sql}) AS #{other_alias} ON ST_Intersects(#{table_alias}.geom, #{other_alias}.buffered_geom)))
@@ -154,7 +156,7 @@ module SpatialFeatures
154
156
 
155
157
  def features_scope(other)
156
158
  scope = Feature
157
- scope = scope.where(:spatial_model_type => Utils.base_class_of(other))
159
+ scope = scope.where(:spatial_model_type => Utils.base_class_of(other).to_s)
158
160
  scope = scope.where(:spatial_model_id => other) unless Utils.class_of(other) == other
159
161
  return scope
160
162
  end
@@ -1,3 +1,3 @@
1
1
  module SpatialFeatures
2
- VERSION = "2.7.5"
2
+ VERSION = "2.7.6"
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.5
4
+ version: 2.7.6
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-07-15 00:00:00.000000000 Z
12
+ date: 2019-07-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  version: '0'
219
219
  requirements: []
220
220
  rubyforge_project:
221
- rubygems_version: 2.7.9
221
+ rubygems_version: 2.7.5
222
222
  signing_key:
223
223
  specification_version: 4
224
224
  summary: Adds spatial methods to a model.