Class: Bonanza::Validators::UrnValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Bonanza::Validators::UrnValidator
- Defined in:
- lib/bonanza/validators/urn_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/bonanza/validators/urn_validator.rb', line 6 def validate_each(record, attribute, value) return unless value.present? if [:allow_empty] unless InfrastructureClient::Urn.new(value.to_s).valid? record.errors.add attribute, :invalid_urn end end |