mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
修复:unit不包含dataset正确返回以及字段验证
This commit is contained in:
15
app/forms/projects/datasets/create_form.rb
Normal file
15
app/forms/projects/datasets/create_form.rb
Normal 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
|
||||
Reference in New Issue
Block a user