From: ardean80 Date: Fri, 16 Feb 2018 13:43:53 +0000 (+0100) Subject: Update country.rb X-Git-Tag: live~3096^2 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/552a47118883e53e2e93a677a94ec231f71e40bc?ds=sidebyside Update country.rb Without adding "Rails.root.join(...)" (or something else returning a complete path to the countries.xml file) this error occurred: "No such file or directory @ rb_sysopen - config/countries.xml" I think it happened because it could not find that file through a relative path. --- diff --git a/lib/country.rb b/lib/country.rb index 3af7e0a21..ab88072ec 100644 --- a/lib/country.rb +++ b/lib/country.rb @@ -19,7 +19,7 @@ class Country def self.load_countries countries = {} - xml = REXML::Document.new(File.read("config/countries.xml")) + xml = REXML::Document.new(File.read(Rails.root.join("config", "countries.xml"))) xml.elements.each("geonames/country") do |ele| code = ele.get_text("countryCode").to_s