Skip to content
Snippets Groups Projects
Commit 2d3f5f14 authored by Jev Zelenkov's avatar Jev Zelenkov
Browse files

fixes postgres "unknown OID" warnings

rails ActiveModel fix: https://github.com/rails/rails/pull/10498
parent c5c45940
No related branches found
No related tags found
No related merge requests found
......@@ -194,13 +194,16 @@ module Geocoder::Store
else
clause = (columns || full_column_name("*"))
end
identifierType = using_postgresql? "::character(255)" : ""
if distance
clause += ", " unless clause.empty?
clause += "#{distance} AS #{distance_column}"
clause += "'#{distance}'#{identifierType} AS #{distance_column}"
end
if bearing
clause += ", " unless clause.empty?
clause += "#{bearing} AS #{bearing_column}"
clause += "'#{bearing}'#{identifierType} AS #{bearing_column}"
end
clause
end
......@@ -222,6 +225,11 @@ module Geocoder::Store
connection.adapter_name.match(/sqlite/i)
end
def using_postgresql?
connection.adapter_name.match(/postgres/i)
end
##
# Value which can be passed to where() to produce no results.
#
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment