Class: DerivationValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- DerivationValidator
- Defined in:
- app/validators/derivation_validator.rb
Overview
Validator for Metasploit::Model::Derivation::ClassMethods#derives.
Instance Method Summary collapse
-
#validate_each(record, attribute, value) ⇒ void
Validates that
attribute
'svalue
equals derived_'s value.
Instance Method Details
#validate_each(record, attribute, value) ⇒ void
This method returns an undefined value.
Validates that attribute
's value
equals derived_'must match its derivation'
.
10 11 12 13 14 15 16 |
# File 'app/validators/derivation_validator.rb', line 10 def validate_each(record, attribute, value) derived_value = record.send("derived_#{attribute}") if value != derived_value record.errors[attribute] << 'must match its derivation' end end |