BigW Consortium Gitlab

Rescue from ActiveRecord::UnknownAttributeError and fallback to fake settings

Signed-off-by: 's avatarRémy Coutable <remy@rymai.me>
parent 632c2939
...@@ -30,15 +30,15 @@ module Gitlab ...@@ -30,15 +30,15 @@ module Gitlab
end end
def in_memory_application_settings 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, # In case migrations the application_settings table is not created yet,
# we fallback to a simple OpenStruct # we fallback to a simple OpenStruct
rescue ActiveRecord::StatementInvalid rescue ActiveRecord::StatementInvalid, ActiveRecord::UnknownAttributeError
fake_application_settings fake_application_settings
end end
def fake_application_settings def fake_application_settings
OpenStruct.new(ApplicationSetting::DEFAULTS) OpenStruct.new(::ApplicationSetting::DEFAULTS)
end end
private private
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
# #
module Gitlab module Gitlab
module ImportSources module ImportSources
extend CurrentSettings
ImportSource = Struct.new(:name, :title, :importer) ImportSource = Struct.new(:name, :title, :importer)
ImportTable = [ 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