From 552a47118883e53e2e93a677a94ec231f71e40bc Mon Sep 17 00:00:00 2001 From: ardean80 Date: Fri, 16 Feb 2018 14:43:53 +0100 Subject: [PATCH] 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. --- lib/country.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.43.2