class ActiveRecord::Validations::AssociationNotSoftDestroyedValidator

Public Instance Methods

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