From d119d3d1b25aac661e6251addf87b280bd37f0c5 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Thu, 11 Apr 2019 06:29:07 +0000 Subject: Align UrlValidator to validate_url gem implementation. Renamed UrlValidator to AddressableUrlValidator to avoid 'url:' naming collision with ActiveModel::Validations::UrlValidator in 'validates' statement. Make use of the options attribute of the parent class ActiveModel::EachValidator. Add more options: allow_nil, allow_blank, message. Renamed 'protocols' option to 'schemes' to match the option naming from UrlValidator. --- app/models/badge.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/models/badge.rb') diff --git a/app/models/badge.rb b/app/models/badge.rb index a244ed473de..50299cd6652 100644 --- a/app/models/badge.rb +++ b/app/models/badge.rb @@ -22,7 +22,7 @@ class Badge < ApplicationRecord scope :order_created_at_asc, -> { reorder(created_at: :asc) } - validates :link_url, :image_url, url: { protocols: %w(http https) } + validates :link_url, :image_url, addressable_url: true validates :type, presence: true def rendered_link_url(project = nil) -- cgit v1.2.1