]> git.openstreetmap.org Git - rails.git/blobdiff - app/validators/invalid_chars_validator.rb
Fix rubocop errors
[rails.git] / app / validators / invalid_chars_validator.rb
index c324fd39457bf0b7460b1e8173f395ad51d9eacd..3860c95a3661192daadda41339f3306e48fc7709 100644 (file)
@@ -2,8 +2,6 @@ class InvalidCharsValidator < ActiveModel::EachValidator
   INVALID_CHARS = "\x00-\x08\x0b-\x0c\x0e-\x1f\x7f\ufffe\uffff".freeze
 
   def validate_each(record, attribute, value)
-    if value =~ /[#{INVALID_CHARS}]/
-      record.errors[attribute] << (options[:message] || "contains invalid chars")
-    end
+    record.errors[attribute] << (options[:message] || "contains invalid chars") if value =~ /[#{INVALID_CHARS}]/
   end
-end
\ No newline at end of file
+end