From fe67c01e57c41e29aba097eea40ac01315118047 Mon Sep 17 00:00:00 2001 From: Andy Brett Date: Fri, 14 May 2021 08:49:23 -0700 Subject: [PATCH] guard against no database, but not against .connected? Similar to b22ce43efe3f1e858161034fcba4c6831c63d3a4 --- config/application.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/application.rb b/config/application.rb index 45c68a66b3..57b5d277ab 100644 --- a/config/application.rb +++ b/config/application.rb @@ -76,10 +76,10 @@ module Openfoodnetwork Spree::Config['checkout_zone'] = ENV['CHECKOUT_ZONE'] Spree::Config['currency'] = ENV['CURRENCY'] - if ActiveRecord::Base.connected? && Spree::Country.table_exists? + begin country = Spree::Country.find_by(iso: ENV['DEFAULT_COUNTRY_CODE']) Spree::Config['default_country_id'] = country.id if country.present? - else + rescue ::ActiveRecord::StatementInvalid Spree::Config['default_country_id'] = 12 # Australia end end