class ActiveRecord::Validations::AssociationNotSoftDestroyedValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/paranoia.rb, line 316
def validate_each(record, attribute, value)
  # if association is soft destroyed, add an error
  if value.present? && value.paranoia_destroyed?
    record.errors.add(attribute, 'has been soft-deleted')
  end
end