]> git.openstreetmap.org Git - rails.git/blob - lib/validators.rb
Fix test which was accidentally testing as the entry user twice
[rails.git] / lib / validators.rb
1 ##
2 # validation method to be included like any other validations methods
3 # in the models definitions. this one checks that the named attribute
4 # is a valid UTF-8 format string.
5 class Utf8Validator < ActiveModel::EachValidator
6   def validate_each(record, attribute, value)
7     record.errors.add(attribute, " is invalid UTF-8") unless UTF8.valid? value
8   end
9 end