]> git.openstreetmap.org Git - rails.git/blob - lib/validators.rb
Refactor to show the Issues link based on the calculated permissions
[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