diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-08 22:26:16 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-01-08 22:26:16 +0300 |
commit | d0a50985ec613584821806062df4eaa39337449c (patch) | |
tree | 97ded486a14bafaca5eec6d14545c6f31470afdd /app | |
parent | 8133e44998236438c46e1b662bd284323287f415 (diff) |
Create ApplicationSettings if does not exist in runtime
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/application_settings_controller.rb | 2 | ||||
-rw-r--r-- | app/models/application_setting.rb | 10 |
2 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb index 39ca0b4feba..5116f1f177a 100644 --- a/app/controllers/admin/application_settings_controller.rb +++ b/app/controllers/admin/application_settings_controller.rb @@ -16,7 +16,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController private def set_application_setting - @application_setting = ApplicationSetting.last + @application_setting = ApplicationSetting.current end def application_setting_params diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 4b885461cbb..47fa6f1071c 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -2,4 +2,14 @@ class ApplicationSetting < ActiveRecord::Base def self.current ApplicationSetting.last end + + def self.create_from_defaults + create( + default_projects_limit: Settings.gitlab['default_projects_limit'], + signup_enabled: Settings.gitlab['signup_enabled'], + signin_enabled: Settings.gitlab['signin_enabled'], + gravatar_enabled: Settings.gravatar['enabled'], + sign_in_text: Settings.extra['sign_in_text'], + ) + end end |