]> git.openstreetmap.org Git - rails.git/blobdiff - app/validators/invalid_url_chars_validator.rb
Fix rubocop errors
[rails.git] / app / validators / invalid_url_chars_validator.rb
index 77a2fc58c0eb65f87fa69edb53583b3a34e7a443..38c4006b72701b25be12a64371f79cff3d818836 100644 (file)
@@ -2,8 +2,6 @@ class InvalidUrlCharsValidator < ActiveModel::EachValidator
   INVALID_URL_CHARS = "/;.,?%#".freeze
 
   def validate_each(record, attribute, value)
-    if value =~ /[#{INVALID_URL_CHARS}]/
-      record.errors[attribute] << (options[:message] || I18n.t("validations.invalid chars", :invalid_chars => INVALID_URL_CHARS))
-    end
+    record.errors[attribute] << (options[:message] || I18n.t("validations.invalid chars", :invalid_chars => INVALID_URL_CHARS)) if value =~ /[#{INVALID_URL_CHARS}]/
   end
-end
\ No newline at end of file
+end