diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-01-09 11:26:26 +0100 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2015-01-09 11:26:26 +0100 |
commit | bc95576e2cbbd2def7a6fce1bde2d0263a3d7da1 (patch) | |
tree | b532cfe1fbab1bcf9d738a547b983ab79406e9b2 /lib | |
parent | d531de0bc9f4b0fe535229a530410d2a3729d610 (diff) | |
download | gitlab-ce-bc95576e2cbbd2def7a6fce1bde2d0263a3d7da1.tar.gz |
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')
-rw-r--r-- | lib/gitlab/current_settings.rb | 12 |
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 |