Class: ParseablePredicateValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ParseablePredicateValidator
- Defined in:
- app/validators/parseable_predicate_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
2 3 4 5 6 7 |
# File 'app/validators/parseable_predicate_validator.rb', line 2 def validate_each record, attribute, value return if value.blank? Predicator.parse value rescue Racc::ParseError, Predicator::Lexer::ScanError record.errors[attribute] << ([:message] || "is not a valid predicate") end |