From 54c0aa788cc365909dc507e6c5e0a454c8179dfc Mon Sep 17 00:00:00 2001 From: Sam <sam.saffron@gmail.com> Date: Thu, 7 Jun 2018 14:51:00 +1000 Subject: [PATCH] FIX: db:create was failing due to site settings --- lib/site_settings/db_provider.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/site_settings/db_provider.rb b/lib/site_settings/db_provider.rb index 3ad32164e98..0887e0edc4d 100644 --- a/lib/site_settings/db_provider.rb +++ b/lib/site_settings/db_provider.rb @@ -57,12 +57,12 @@ class SiteSettings::DbProvider # table is not in the db yet, initial migration, etc def table_exists? @table_exists ||= {} - - unless @table_exists[current_site] - @table_exists[current_site] = ActiveRecord::Base.connection.table_exists?(@model.table_name) + begin + @table_exists[current_site] ||= ActiveRecord::Base.connection.table_exists?(@model.table_name) + rescue + STDERR.puts "No connection to db, unable to retrieve site settings! (normal when running db:create)" + @table_exists[current_site] = false end - - @table_exists[current_site] end end