Class: ProposalLengthValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ProposalLengthValidator
- Defined in:
- app/validators/proposal_length_validator.rb
Overview
This validator takes care of ensuring the validated attributes are long enough and not too long. The difference to the Rails length validator is that this allows the minimum and maximum values to be lambdas allowing us to fetch the maximum length dynamically for each proposals component.
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
8 9 10 11 12 13 |
# File 'app/validators/proposal_length_validator.rb', line 8 def validate_each(record, attribute, value) return if value.blank? validate_min_length(record, attribute, value) validate_max_length(record, attribute, value) end |