Permalink
Browse files

fixed a bug when calling distance_to on an AR model (had to cast to n…

…umeric)

git-svn-id: http://geokit.rubyforge.org/svn/trunk@21 9265c765-0211-4c68-b2df-6d1bd6e20c4d
  • Loading branch information...
1 parent faf2f9c commit beb682451e5201a250bc7a5d773ed23cf3ae6f58 lewisac committed Feb 16, 2007
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/geo_kit/mappable.rb
View
@@ -78,14 +78,14 @@ def units_per_longitude_degree(lat, units)
# and potentially customized the latitude attribute. Otherwise, fall back to default lat
# attribute.
def get_lat(point)
- acting_as_mappable?(point) ? eval("point.#{point.class.lat_column_name}") : point.lat
+ acting_as_mappable?(point) ? eval("point.#{point.class.lat_column_name}.to_f") : point.lat
end
# Ensure proper longitude is returned for Mappable instances that have invoked acts_as_mappable
# and potentially customized the longitude attribute. Otherwise, fall back to default lng
# attribute.
def get_lng(point)
- acting_as_mappable?(point) ? eval("point.#{point.class.lng_column_name}") : point.lng
+ acting_as_mappable?(point) ? eval("point.#{point.class.lng_column_name}.to_f") : point.lng
end
# Returns true if the object knows acts_as_mappable and has actually invoked it. Using the

0 comments on commit beb6824

Please sign in to comment.