|
|
|
@ -7,5 +7,11 @@ class Users::ApplyProfessionalAuthForm
|
|
|
|
|
validates :department_id, numericality: { only_integer: true, greater_than: 0 }, allow_blank: true
|
|
|
|
|
validates :identity, presence: true, inclusion: { in: %w(student teacher professional) }
|
|
|
|
|
validates :extra, presence: true
|
|
|
|
|
validates :attachment_ids, presence: true
|
|
|
|
|
validates :validate_attachment_ids
|
|
|
|
|
|
|
|
|
|
def validate_attachment_ids
|
|
|
|
|
unless attachment_ids.is_a?(Array) || attachment_ids.length != 1
|
|
|
|
|
raise("图片参数不对")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|