From 57444dca65fc38e389d87e0ddd4f1f6b10faa2f8 Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Mon, 9 Sep 2024 10:39:43 +0200 Subject: [PATCH] Skip initialization of sharable models if DB is not connected --- app/models/concerns/shareable.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/models/concerns/shareable.rb b/app/models/concerns/shareable.rb index f242aad4c..95ba20437 100644 --- a/app/models/concerns/shareable.rb +++ b/app/models/concerns/shareable.rb @@ -46,6 +46,12 @@ module Shareable ).where.not(team: teams)) .distinct } + rescue ActiveRecord::NoDatabaseError, + ActiveRecord::ConnectionNotEstablished, + ActiveRecord::StatementInvalid, + PG::ConnectionBad + + Rails.logger.info('Not connected to database, skipping sharable model initialization.') end def shareable_write?