diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-04-11 06:29:07 +0000 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-04-11 06:29:07 +0000 |
commit | d119d3d1b25aac661e6251addf87b280bd37f0c5 (patch) | |
tree | aeaf0d9503326ec7f51968e8d1de48d83ce90503 /app/models/badge.rb | |
parent | 79bf4bdaad438dc0f82771b102f3c07225a428da (diff) | |
download | gitlab-ce-d119d3d1b25aac661e6251addf87b280bd37f0c5.tar.gz |
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.
Diffstat (limited to 'app/models/badge.rb')
-rw-r--r-- | app/models/badge.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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) |