Method: Content::Validators::ContentValidator#validate_each
- Defined in:
- app/models/content/validators/content_validator.rb
#validate_each(record, attribute, value) ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/models/content/validators/content_validator.rb', line 4 def validate_each(record, attribute, value) begin value.encode("UTF-8", 'binary') if !value.blank? && value.respond_to?(:encode) rescue record.errors[attribute] << ([:message] || _("cannot be a binary file.")) end end |