Commit 765d57d6 authored by Rémy Coutable's avatar Rémy Coutable

Rescue from ActiveRecord::UnknownAttributeError and fallback to fake settings

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 632c2939
......@@ -30,15 +30,15 @@ module Gitlab
end
def in_memory_application_settings
@in_memory_application_settings ||= ApplicationSetting.new(ApplicationSetting::DEFAULTS)
@in_memory_application_settings ||= ::ApplicationSetting.new(::ApplicationSetting::DEFAULTS)
# In case migrations the application_settings table is not created yet,
# we fallback to a simple OpenStruct
rescue ActiveRecord::StatementInvalid
rescue ActiveRecord::StatementInvalid, ActiveRecord::UnknownAttributeError
fake_application_settings
end
def fake_application_settings
OpenStruct.new(ApplicationSetting::DEFAULTS)
OpenStruct.new(::ApplicationSetting::DEFAULTS)
end
private
......
......@@ -5,8 +5,6 @@
#
module Gitlab
module ImportSources
extend CurrentSettings
ImportSource = Struct.new(:name, :title, :importer)
ImportTable = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment