]> git.openstreetmap.org Git - rails.git/blobdiff - app/validators/trailing_whitespace_validator.rb
Changed User model to not allow nil display_name (w/ tests)
[rails.git] / app / validators / trailing_whitespace_validator.rb
index bb34ef463088e7af104f70caf4415d81a9d5adfe..aacc6dd043f2c503dfc32200ad4072fdb9fb4dd9 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