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

Fix: error when FreeGeoIP returns nil state_code.

parent b876da7e
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,8 @@ module Geocoder::Result
class Freegeoip < Base
def address(format = :full)
"#{city}#{', ' + state_code unless state_code == ''} #{postal_code}, #{country}".sub(/^[ ,]*/, "")
s = state_code.to_s == "" ? "" : ", #{state_code}"
"#{city}#{s} #{postal_code}, #{country}".sub(/^[ ,]*/, "")
end
def city
......
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