Class: AbAdmin::Concerns::Validations::AssetValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/ab_admin/concerns/validations.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object


16
17
18
19
20
# File 'lib/ab_admin/concerns/validations.rb', line 16

def validate_each(record, attribute, value)
  if Array(record.fileupload_asset(attribute)).all?{|a| a.new_record? }
    record.errors.add(attribute, :blank)
  end
end