]> git.openstreetmap.org Git - rails.git/blobdiff - app/validators/leading_whitespace_validator.rb
Converted invalid_chars validator to use locale
[rails.git] / app / validators / leading_whitespace_validator.rb
index fcefb0a196eeccc05a16a85a0659b7df9970bcda..90e7d9c95bf9f0854c25f02e6c30df2e59e1a7db 100644 (file)
@@ -1,7 +1,5 @@
 class LeadingWhitespaceValidator < ActiveModel::EachValidator
   def validate_each(record, attribute, value)
-    if value =~ /\A\s/
-      record.errors[attribute] << (options[:message] || I18n.t("validations.leading whitespace"))
-    end
+    record.errors[attribute] << (options[:message] || I18n.t("validations.leading_whitespace")) if value =~ /\A\s/
   end
-end
\ No newline at end of file
+end