]> git.openstreetmap.org Git - rails.git/blobdiff - app/validators/trailing_whitespace_validator.rb
Fix rubocop errors
[rails.git] / app / validators / trailing_whitespace_validator.rb
index bb34ef463088e7af104f70caf4415d81a9d5adfe..03d6ef4db3bc88924ab370548d30faab2d97e650 100644 (file)
@@ -1,7 +1,5 @@
 class TrailingWhitespaceValidator < ActiveModel::EachValidator
   def validate_each(record, attribute, value)
-    if value =~ /\s\z/
-      record.errors[attribute] << (options[:message] || I18n.t("validations.trailing whitespace"))
-    end
+    record.errors[attribute] << (options[:message] || I18n.t("validations.trailing whitespace")) if value =~ /\s\z/
   end
-end
\ No newline at end of file
+end