Skip to content
Snippets Groups Projects
Commit e886fbfb authored by Alex Reisner's avatar Alex Reisner
Browse files

Merge pull request #236 from dubroe/master

Put in full_column_name to avoid ambiguous column errors
parents 7a9f85ca 9eef3a3a
No related branches found
No related tags found
No related merge requests found
......@@ -202,10 +202,10 @@ module Geocoder::Store
end
if options[:bearing]
bearing = "CASE " +
"WHEN (#{lat_attr} >= #{latitude} AND #{lon_attr} >= #{longitude}) THEN 45.0 " +
"WHEN (#{lat_attr} < #{latitude} AND #{lon_attr} >= #{longitude}) THEN 135.0 " +
"WHEN (#{lat_attr} < #{latitude} AND #{lon_attr} < #{longitude}) THEN 225.0 " +
"WHEN (#{lat_attr} >= #{latitude} AND #{lon_attr} < #{longitude}) THEN 315.0 " +
"WHEN (#{full_column_name(lat_attr)} >= #{latitude} AND #{full_column_name(lon_attr)} >= #{longitude}) THEN 45.0 " +
"WHEN (#{full_column_name(lat_attr)} < #{latitude} AND #{full_column_name(lon_attr)} >= #{longitude}) THEN 135.0 " +
"WHEN (#{full_column_name(lat_attr)} < #{latitude} AND #{full_column_name(lon_attr)} < #{longitude}) THEN 225.0 " +
"WHEN (#{full_column_name(lat_attr)} >= #{latitude} AND #{full_column_name(lon_attr)} < #{longitude}) THEN 315.0 " +
"END"
else
bearing = false
......@@ -216,7 +216,7 @@ module Geocoder::Store
b = Geocoder::Calculations.bounding_box([latitude, longitude], radius, options)
conditions = [
"#{lat_attr} BETWEEN ? AND ? AND #{lon_attr} BETWEEN ? AND ?"] +
"#{full_column_name(lat_attr)} BETWEEN ? AND ? AND #{full_column_name(lon_attr)} BETWEEN ? AND ?"] +
[b[0], b[2], b[1], b[3]
]
default_near_scope_options(latitude, longitude, radius, options).merge(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment