Class: SteelWheel::Query::DependencyValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/steel_wheel/query/dependency_validator.rb

Overview

Presence validation for dependencies

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



7
8
9
10
11
# File 'lib/steel_wheel/query/dependency_validator.rb', line 7

def validate_each(record, attribute, value)
  return if value

  record.errors.add :base, :not_found, message: options.fetch(:message, "#{attribute.to_s.humanize} is missing")
end