修复:unit不包含dataset正确返回以及字段验证

This commit is contained in:
2024-04-07 14:28:42 +08:00
parent 7d560032b0
commit 7440a79cc4
3 changed files with 33 additions and 1 deletions

View File

@@ -0,0 +1,15 @@
class Projects::Datasets::CreateForm < BaseForm
attr_accessor :title, :description, :license_id, :paper_content
validates :title, presence: true, length: { maximum: 100 }
validates :description, presence: true, length: { maximum: 500 }
validates :paper_content, length: { maximum: 500 }
validate :check_license
def check_license
raise "license_id值无效. " if license_id && License.find_by(id: license_id).blank?
end
end