15 lines
447 B
Ruby
15 lines
447 B
Ruby
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 |