diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-09 03:08:41 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-09 03:08:41 +0300 |
commit | c02e2a5ef6b928da420e844b54fc6bbce16754c8 (patch) | |
tree | 1f738c4c0c7fc04a3235e8bad807972a740611f2 /app/models/namespace_setting.rb | |
parent | b0980f5557a8621fb08785b06be950ee46796c18 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/namespace_setting.rb')
-rw-r--r-- | app/models/namespace_setting.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/namespace_setting.rb b/app/models/namespace_setting.rb index 53bfa3d979e..40c46fa6e3d 100644 --- a/app/models/namespace_setting.rb +++ b/app/models/namespace_setting.rb @@ -3,7 +3,19 @@ class NamespaceSetting < ApplicationRecord belongs_to :namespace, inverse_of: :namespace_settings + validate :default_branch_name_content + + NAMESPACE_SETTINGS_PARAMS = [:default_branch_name].freeze + self.primary_key = :namespace_id + + def default_branch_name_content + return if default_branch_name.nil? + + if default_branch_name.blank? + errors.add(:default_branch_name, "can not be an empty string") + end + end end NamespaceSetting.prepend_if_ee('EE::NamespaceSetting') |