From d5a2bd68470bdbf5888042c7eb547ae508be376f Mon Sep 17 00:00:00 2001 From: Alex Reisner <alex@alexreisner.com> Date: Tue, 1 May 2012 22:47:24 -0400 Subject: [PATCH] Use full column name where we forgot to before. --- lib/geocoder/stores/active_record.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/geocoder/stores/active_record.rb b/lib/geocoder/stores/active_record.rb index a10bc2ca..3d96012c 100644 --- a/lib/geocoder/stores/active_record.rb +++ b/lib/geocoder/stores/active_record.rb @@ -125,19 +125,19 @@ module Geocoder::Store when :linear "CAST(" + "DEGREES(ATAN2( " + - "RADIANS(#{lon_attr} - #{longitude}), " + - "RADIANS(#{lat_attr} - #{latitude})" + + "RADIANS(#{full_column_name(lon_attr)} - #{longitude}), " + + "RADIANS(#{full_column_name(lat_attr)} - #{latitude})" + ")) + 360 " + "AS decimal) % 360" when :spherical "CAST(" + "DEGREES(ATAN2( " + - "SIN(RADIANS(#{lon_attr} - #{longitude})) * " + - "COS(RADIANS(#{lat_attr})), (" + - "COS(RADIANS(#{latitude})) * SIN(RADIANS(#{lat_attr}))" + + "SIN(RADIANS(#{full_column_name(lon_attr)} - #{longitude})) * " + + "COS(RADIANS(#{full_column_name(lat_attr)})), (" + + "COS(RADIANS(#{latitude})) * SIN(RADIANS(#{full_column_name(lat_attr)}))" + ") - (" + - "SIN(RADIANS(#{latitude})) * COS(RADIANS(#{lat_attr})) * " + - "COS(RADIANS(#{lon_attr} - #{longitude}))" + + "SIN(RADIANS(#{latitude})) * COS(RADIANS(#{full_column_name(lat_attr)})) * " + + "COS(RADIANS(#{full_column_name(lon_attr)} - #{longitude}))" + ")" + ")) + 360 " + "AS decimal) % 360" -- GitLab