Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-01-26 17:11:15 +0300
committerRémy Coutable <remy@rymai.me>2016-01-26 17:11:15 +0300
commite6f3fe5d3b16809634dd655b3d265c683b538b12 (patch)
treea4849d406b810356f3f8b61ee5074c5620b8074a /lib
parentcd22da3ebda969779c47f1652f3876daa5edd7f2 (diff)
Ensure rake tasks that don't need a DB connection can be run without one
When using ActiveRecord::Base.connection.active? without a DB connection, we get a "PG::ConnectionBad: could not connect to server" error because ActiveRecord::Base.connection doesn't exist. By using ActiveRecord::Base.connected? we ensure we don't get this error if the connection is missing, which is the all point of the Gitlab::CurrentSettings#connect_to_db? method!
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/current_settings.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb
index 429f1f9bb56..19b7427256c 100644
--- a/lib/gitlab/current_settings.rb
+++ b/lib/gitlab/current_settings.rb
@@ -38,7 +38,7 @@ module Gitlab
true
end
- use_db && ActiveRecord::Base.connection.active? &&
+ use_db && ActiveRecord::Base.connected? &&
# The following condition is important: if a migrations adds a
# column to the application_settings table and a validation in
# the ApplicationSetting uses this new column we might end-up in