From d071b7d159ede67fa4a7e2ceac929e9e4c19fa6d Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 17 Mar 2020 17:03:16 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=84=E4=BB=B6=E7=9A=84=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E5=A4=96=E9=93=BE=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/attachment.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 001883fb6..dc8b44d1e 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -28,6 +28,7 @@ class Attachment < ApplicationRecord scope :no_link, -> {where(link: nil)} validates_length_of :description, maximum: 100, message: "不能超过100个字符" + validates :link, format: { with: CustomRegexp::URL, message: "必须为网址超链接" }, allow_blank: true DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z)