Class: AllowedTypeValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- AllowedTypeValidator
- Defined in:
- lib/avromatic/model/allowed_type_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, name, value) ⇒ Object
2 3 4 5 6 |
# File 'lib/avromatic/model/allowed_type_validator.rb', line 2 def validate_each(record, name, value) if [:in].find { |klass| value.is_a?(klass) }.nil? record.errors[name] << "does not have the expected type #{[:in]}" end end |