active_record_nearest_neighbor 0.2.1 → 0.3.4

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
  SHA1:
3
- metadata.gz: 82fc2629ac7b5f4d7f1c62fc81adc6f41ce2421d
4
- data.tar.gz: cc290e6f1fa1f1e9d80e980cbd1dad7d24ddae13
3
+ metadata.gz: 693212853f8303fbb9140919c762aaa76c4200b9
4
+ data.tar.gz: b4c89b0bfdf198ebfe66aa1b03c06a1889766c8d
5
5
  SHA512:
6
- metadata.gz: 61024606f12fdbc3533895a96cd2dbb02d0274fc84f35d2e78c5c2707ff61844d3b88f3b88ed2178ffdab87ae975fb430d023b1da69066ba05327e5fd38964dd
7
- data.tar.gz: 64cbb6e98c725e71c6a06a0a4e9ca4cc0a8c5071765127d235352e250c0e10060e58dd4298243f1e25faffb81454ce04bd2a9eb32a4f8784b860a2f5c272f09e
6
+ metadata.gz: c35e463c80d708db5101bf1bff0d396636fcae6c5036c3a0af93565f77eaf3a349459ab783764de78cf510b8d9424373466d9ae648e9c6fe025f7960afac5654
7
+ data.tar.gz: c84d2858ad6ffc36c11d33e1e8545b5d5513879686df04e51b4ca50ab453f5c8f9de840996284e3e816ef2d61000037db4a305bb4df8bc33a483b4e966c2c391
@@ -11,7 +11,7 @@ module ActiveRecord::Base::NearestNeighbor::Scopes
11
11
  # If we have an object id, don't include the object in results
12
12
  not_id_subclause = params[:id] ? "id != #{params[:id]}" : ''
13
13
 
14
- where(%{ST_DWithin(points.lonlat, ST_GeographyFromText('SRID=4326;POINT(#{longitude} #{latitude})')::geometry, #{distance})}).
14
+ where(%{ST_DWithin(#{table_name}.lonlat, ST_GeographyFromText('SRID=4326;POINT(#{longitude} #{latitude})')::geometry, #{distance})}).
15
15
  where(not_id_subclause).
16
16
  order(%{ST_Distance(
17
17
  #{table_name}.lonlat,
@@ -1,3 +1,3 @@
1
1
  module ActiveRecordNearestNeighbor
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.4"
3
3
  end
@@ -1,9 +1,7 @@
1
- require 'pry'
2
-
3
1
  namespace :nearest_neighbor do
4
2
  desc "Create a new table with latitude, longitude, lonlat (point type), and a spatial index for lonlat"
5
- task :create, [:table_name] do |task, args|
6
- timestamp = Time.now.strftime("%Y%m%d%H%M%S")
3
+ task :create, [:table_name] => :environment do |task, args|
4
+ timestamp = Time.zone.now.strftime("%Y%m%d%H%M%S")
7
5
  table_name = args[:table_name]
8
6
  class_name = table_name.split("_").map(&:capitalize).join
9
7
  migration =
@@ -25,8 +23,8 @@ end}
25
23
  end
26
24
 
27
25
  desc "Add columns to existing table: latitude, longitude, lonlat (point type), and a spatial index for lonlat"
28
- task :add_columns, [:table_name] do |task, args|
29
- timestamp = Time.now.strftime("%Y%m%d%H%M%S")
26
+ task :add_columns, [:table_name] => :environment do |task, args|
27
+ timestamp = Time.zone.now.strftime("%Y%m%d%H%M%S")
30
28
  table_name = args[:table_name]
31
29
  class_name = table_name.split("_").map(&:capitalize).join
32
30
  migration =
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_nearest_neighbor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hautau
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-14 00:00:00.000000000 Z
11
+ date: 2015-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -89,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.2.2
92
+ rubygems_version: 2.4.5
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: A Rails/Active Record plugin to easily add nearest neighbor geospatial queries