active_record_nearest_neighbor 0.2.1 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 693212853f8303fbb9140919c762aaa76c4200b9
|
4
|
+
data.tar.gz: b4c89b0bfdf198ebfe66aa1b03c06a1889766c8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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,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.
|
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:
|
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.
|
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
|