acts_as_geocodable 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/acts_as_geocodable.rb +5 -4
- data/lib/acts_as_geocodable/version.rb +1 -1
- metadata +33 -12
data/lib/acts_as_geocodable.rb
CHANGED
@@ -76,7 +76,7 @@ module ActsAsGeocodable #:nodoc:
|
|
76
76
|
# declaration.
|
77
77
|
#
|
78
78
|
scope :origin, lambda {|*args|
|
79
|
-
origin = args[0]
|
79
|
+
origin = location_to_geocode(args[0])
|
80
80
|
options = {
|
81
81
|
:units => acts_as_geocodable_options[:units],
|
82
82
|
}.merge(args[1] || {})
|
@@ -86,7 +86,9 @@ module ActsAsGeocodable #:nodoc:
|
|
86
86
|
#{acts_as_geocodable_options[:distance_column]}")
|
87
87
|
|
88
88
|
scope = scope.where("#{distance_sql} > #{options[:beyond]}") if options[:beyond]
|
89
|
-
|
89
|
+
if options[:within]
|
90
|
+
scope = scope.where("(#{distance_sql} <= #{options[:within]}) OR (geocodes.latitude = :lat AND geocodes.longitude = :long)", {:lat => origin.latitude, :long => origin.longitude})
|
91
|
+
end
|
90
92
|
scope
|
91
93
|
}
|
92
94
|
|
@@ -122,7 +124,7 @@ module ActsAsGeocodable #:nodoc:
|
|
122
124
|
case location
|
123
125
|
when Geocode then location
|
124
126
|
when InstanceMethods then location.geocode
|
125
|
-
when String, Fixnum then Geocode.find_or_create_by_query(location)
|
127
|
+
when String, Fixnum then Geocode.find_or_create_by_query(location.to_s)
|
126
128
|
end
|
127
129
|
end
|
128
130
|
|
@@ -159,7 +161,6 @@ module ActsAsGeocodable #:nodoc:
|
|
159
161
|
private
|
160
162
|
|
161
163
|
def sql_for_distance(origin, units = acts_as_geocodable_options[:units])
|
162
|
-
origin = location_to_geocode(origin)
|
163
164
|
Graticule::Distance::Spherical.to_sql(
|
164
165
|
:latitude => origin.latitude,
|
165
166
|
:longitude => origin.longitude,
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_geocodable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 13
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 2
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 2.0.
|
9
|
+
- 1
|
10
|
+
version: 2.0.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Daniel Morrison
|
@@ -16,70 +17,79 @@ autorequire:
|
|
16
17
|
bindir: bin
|
17
18
|
cert_chain: []
|
18
19
|
|
19
|
-
date: 2010-
|
20
|
+
date: 2010-11-15 00:00:00 -05:00
|
20
21
|
default_executable:
|
21
22
|
dependencies:
|
22
23
|
- !ruby/object:Gem::Dependency
|
23
24
|
prerelease: false
|
24
|
-
type: :runtime
|
25
25
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
26
27
|
requirements:
|
27
28
|
- - ">="
|
28
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 15
|
29
31
|
segments:
|
30
32
|
- 2
|
31
33
|
- 0
|
32
34
|
- 0
|
33
35
|
version: 2.0.0
|
34
36
|
requirement: *id001
|
37
|
+
type: :runtime
|
35
38
|
name: graticule
|
36
39
|
- !ruby/object:Gem::Dependency
|
37
40
|
prerelease: false
|
38
|
-
type: :development
|
39
41
|
version_requirements: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
40
43
|
requirements:
|
41
44
|
- - ">="
|
42
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 3
|
43
47
|
segments:
|
44
48
|
- 0
|
45
49
|
version: "0"
|
46
50
|
requirement: *id002
|
51
|
+
type: :development
|
47
52
|
name: rails
|
48
53
|
- !ruby/object:Gem::Dependency
|
49
54
|
prerelease: false
|
50
|
-
type: :development
|
51
55
|
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
52
57
|
requirements:
|
53
58
|
- - "="
|
54
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 21
|
55
61
|
segments:
|
56
62
|
- 1
|
57
63
|
- 2
|
58
64
|
- 5
|
59
65
|
version: 1.2.5
|
60
66
|
requirement: *id003
|
67
|
+
type: :development
|
61
68
|
name: sqlite3-ruby
|
62
69
|
- !ruby/object:Gem::Dependency
|
63
70
|
prerelease: false
|
64
|
-
type: :development
|
65
71
|
version_requirements: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
66
73
|
requirements:
|
67
74
|
- - "="
|
68
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 45
|
69
77
|
segments:
|
70
78
|
- 2
|
71
79
|
- 8
|
72
80
|
- 1
|
73
81
|
version: 2.8.1
|
74
82
|
requirement: *id004
|
83
|
+
type: :development
|
75
84
|
name: mysql
|
76
85
|
- !ruby/object:Gem::Dependency
|
77
86
|
prerelease: false
|
78
|
-
type: :development
|
79
87
|
version_requirements: &id005 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
80
89
|
requirements:
|
81
90
|
- - ~>
|
82
91
|
- !ruby/object:Gem::Version
|
92
|
+
hash: 31098209
|
83
93
|
segments:
|
84
94
|
- 2
|
85
95
|
- 0
|
@@ -87,42 +97,49 @@ dependencies:
|
|
87
97
|
- beta
|
88
98
|
version: 2.0.0.beta
|
89
99
|
requirement: *id005
|
100
|
+
type: :development
|
90
101
|
name: rspec
|
91
102
|
- !ruby/object:Gem::Dependency
|
92
103
|
prerelease: false
|
93
|
-
type: :development
|
94
104
|
version_requirements: &id006 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
95
106
|
requirements:
|
96
107
|
- - ">="
|
97
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
98
110
|
segments:
|
99
111
|
- 0
|
100
112
|
version: "0"
|
101
113
|
requirement: *id006
|
114
|
+
type: :development
|
102
115
|
name: factory_girl
|
103
116
|
- !ruby/object:Gem::Dependency
|
104
117
|
prerelease: false
|
105
|
-
type: :development
|
106
118
|
version_requirements: &id007 !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
107
120
|
requirements:
|
108
121
|
- - ">="
|
109
122
|
- !ruby/object:Gem::Version
|
123
|
+
hash: 3
|
110
124
|
segments:
|
111
125
|
- 0
|
112
126
|
version: "0"
|
113
127
|
requirement: *id007
|
128
|
+
type: :development
|
114
129
|
name: database_cleaner
|
115
130
|
- !ruby/object:Gem::Dependency
|
116
131
|
prerelease: false
|
117
|
-
type: :development
|
118
132
|
version_requirements: &id008 !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
119
134
|
requirements:
|
120
135
|
- - ">="
|
121
136
|
- !ruby/object:Gem::Version
|
137
|
+
hash: 3
|
122
138
|
segments:
|
123
139
|
- 0
|
124
140
|
version: "0"
|
125
141
|
requirement: *id008
|
142
|
+
type: :development
|
126
143
|
name: ruby-debug
|
127
144
|
description: Simple geocoding for Rails ActiveRecord models. See the README for more details.
|
128
145
|
email: info@collectiveidea.com
|
@@ -154,23 +171,27 @@ rdoc_options:
|
|
154
171
|
require_paths:
|
155
172
|
- lib
|
156
173
|
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
none: false
|
157
175
|
requirements:
|
158
176
|
- - ">="
|
159
177
|
- !ruby/object:Gem::Version
|
178
|
+
hash: 3
|
160
179
|
segments:
|
161
180
|
- 0
|
162
181
|
version: "0"
|
163
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
183
|
+
none: false
|
164
184
|
requirements:
|
165
185
|
- - ">="
|
166
186
|
- !ruby/object:Gem::Version
|
187
|
+
hash: 3
|
167
188
|
segments:
|
168
189
|
- 0
|
169
190
|
version: "0"
|
170
191
|
requirements: []
|
171
192
|
|
172
193
|
rubyforge_project:
|
173
|
-
rubygems_version: 1.3.
|
194
|
+
rubygems_version: 1.3.7
|
174
195
|
signing_key:
|
175
196
|
specification_version: 3
|
176
197
|
summary: Simple geocoding for Rails ActiveRecord models
|