Class: Quby::TypeValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Quby::TypeValidator
- Defined in:
- lib/active_model_modules/type_validator.rb
Overview
validates :key, ‘quby/type’: Symbol
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
3 4 5 6 7 |
# File 'lib/active_model_modules/type_validator.rb', line 3 def validate_each(record, attribute, value) return if value.is_a? [:is_a] record.errors.add(attribute, "Is not of type #{[:is_a]}") end |