Class: Content::Validators::DescriptionFormat
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Content::Validators::DescriptionFormat
- Defined in:
- app/models/content/validators/description_format.rb
Constant Summary collapse
- MAX_LENGTH =
1000
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
17 18 19 20 21 |
# File 'app/models/content/validators/description_format.rb', line 17 def validate_each(record, attribute, value) if value record.errors[attribute] << N_("cannot contain more than %s characters") % MAX_LENGTH unless value.length <= MAX_LENGTH end end |