geocoder 0.9.12 → 0.9.13

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of geocoder might be problematic. Click here for more details.

data/CHANGELOG.rdoc CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Per-release changes to Geocoder.
4
4
 
5
+ == 0.9.13 (2011 Apr 11)
6
+
7
+ * Fix "can't find special index: 2d" error when using Mongoid with Ruby 1.8.
8
+
5
9
  == 0.9.12 (2011 Apr 6)
6
10
 
7
11
  * Add support for Mongoid.
data/README.rdoc CHANGED
@@ -122,7 +122,7 @@ Some utility methods are also available:
122
122
  => 3619.77359999382
123
123
 
124
124
  # find the geographic center (aka center of gravity) of objects or points
125
- Geocoder::Calculations.geographic_center(city1, city2, [40.22,-73.99], city4)
125
+ Geocoder::Calculations.geographic_center([city1, city2, [40.22,-73.99], city4])
126
126
  => [35.14968, -90.048929]
127
127
 
128
128
  Please see the code for more methods and detailed information about arguments (eg, working with kilometers).
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.12
1
+ 0.9.13
@@ -19,11 +19,17 @@ module Geocoder::Store
19
19
  coords = Geocoder::Calculations.extract_coordinates(location)
20
20
  radius = args.size > 0 ? args.shift : 20
21
21
  options = args.size > 0 ? args.shift : {}
22
- conds = {:coordinates => {
23
- "$nearSphere" => coords.reverse,
24
- "$maxDistance" => Geocoder::Calculations.distance_to_radians(
25
- radius, options[:units] || :mi)
26
- }}
22
+
23
+ # Use BSON::OrderedHash if Ruby's hashes are unordered.
24
+ # Conditions must be in order required by indexes (see mongo gem).
25
+ empty = RUBY_VERSION.split('.')[1].to_i < 9 ? BSON::OrderedHash.new : {}
26
+
27
+ conds = empty.clone
28
+ conds[:coordinates] = empty.clone
29
+ conds[:coordinates]["$nearSphere"] = coords.reverse
30
+ conds[:coordinates]["$maxDistance"] = \
31
+ Geocoder::Calculations.distance_to_radians(radius, options[:units] || :mi)
32
+
27
33
  if obj = options[:exclude]
28
34
  conds[:_id.ne] = obj.id
29
35
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: geocoder
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.12
5
+ version: 0.9.13
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alex Reisner
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-04-06 00:00:00 -04:00
13
+ date: 2011-04-11 00:00:00 -04:00
14
14
  default_executable:
15
15
  dependencies: []
16
16