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
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-01-09 13:26:26 +0300
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-01-09 13:26:26 +0300
commitbc95576e2cbbd2def7a6fce1bde2d0263a3d7da1 (patch)
treeb532cfe1fbab1bcf9d738a547b983ab79406e9b2 /lib/gitlab/current_settings.rb
parentd531de0bc9f4b0fe535229a530410d2a3729d610 (diff)
Rescue missing database errors
While loading the Rails app we cannot assume that the gitlabhq_xxx database exists already. If we do, `rake gitlab:setup` breaks! This is a quick hack to make sure that fresh development setups of GitLab (from master) will work again.
Diffstat (limited to 'lib/gitlab/current_settings.rb')
-rw-r--r--lib/gitlab/current_settings.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/gitlab/current_settings.rb b/lib/gitlab/current_settings.rb
index f3b9dcacdee..5d88a601dea 100644
--- a/lib/gitlab/current_settings.rb
+++ b/lib/gitlab/current_settings.rb
@@ -1,10 +1,14 @@
module Gitlab
module CurrentSettings
def current_application_settings
- if ActiveRecord::Base.connection.table_exists?('application_settings')
- ApplicationSetting.current ||
- ApplicationSetting.create_from_defaults
- else
+ begin
+ if ActiveRecord::Base.connection.table_exists?('application_settings')
+ ApplicationSetting.current ||
+ ApplicationSetting.create_from_defaults
+ else
+ fake_application_settings
+ end
+ rescue ActiveRecord::NoDatabaseError
fake_application_settings
end
end