[ADD]组织项目相关

This commit is contained in:
2021-01-19 19:02:51 +08:00
parent 1dc43a23b7
commit f094fe1799
31 changed files with 406 additions and 56 deletions

View File

@@ -7,7 +7,7 @@ class Projects::CreateForm < BaseForm
:project_category_id, :project_language_id, presence: true
validates :repository_name, format: { with: REPOSITORY_NAME_REGEX, multiline: true, message: "只能含有数字、字母、下划线且不能以下划线开头和结尾" }
validate :check_ignore, :check_license
validate :check_ignore, :check_license, :check_owner
validate do
check_project_category(project_category_id)
check_project_language(project_language_id)
@@ -20,4 +20,8 @@ class Projects::CreateForm < BaseForm
def check_ignore
raise "ignore_id值无效." if ignore_id && Ignore.find_by(id: ignore_id).blank?
end
def check_owner
raise "user_id值无效." if user_id && Owner.find_by(id: user_id).blank?
end
end