Class: SteelWheel::Query::ExistsValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- SteelWheel::Query::ExistsValidator
- Defined in:
- lib/steel_wheel/query/exists_validator.rb
Overview
Presence validation for loaders
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/steel_wheel/query/exists_validator.rb', line 7 def validate_each(record, attribute, value) return unless value.blank? error_key = [:base] ? :base : attribute record.errors.add(error_key, :not_found, message: .fetch(:message, 'not found')) end |