diff options
author | Thong Kuah <tkuah@gitlab.com> | 2019-04-11 09:29:07 +0300 |
---|---|---|
committer | James Lopez <james@gitlab.com> | 2019-04-11 09:29:07 +0300 |
commit | d119d3d1b25aac661e6251addf87b280bd37f0c5 (patch) | |
tree | aeaf0d9503326ec7f51968e8d1de48d83ce90503 /app/models/remote_mirror.rb | |
parent | 79bf4bdaad438dc0f82771b102f3c07225a428da (diff) |
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/remote_mirror.rb')
-rw-r--r-- | app/models/remote_mirror.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/remote_mirror.rb b/app/models/remote_mirror.rb index 5610cfe0f24..b2fd5394a03 100644 --- a/app/models/remote_mirror.rb +++ b/app/models/remote_mirror.rb @@ -17,7 +17,7 @@ class RemoteMirror < ApplicationRecord belongs_to :project, inverse_of: :remote_mirrors - validates :url, presence: true, public_url: { protocols: %w(ssh git http https), allow_blank: true, enforce_user: true } + validates :url, presence: true, public_url: { schemes: %w(ssh git http https), allow_blank: true, enforce_user: true } before_save :set_new_remote_name, if: :mirror_url_changed? |