app/models/contact.rb
# TODO: refactor, it should not allow to destroy with normal destroy,
# no need separate method
# should use only in transaction
refactor, it should not allow to destroy with normal destroy,
no need separate method
should use only in transaction
refactor it should not allow to destroy with normal destroy no need separate method should use only in transaction
def destroy_and_clean
    if domains_present?
      errors.add(:domains, :exist)
      return false
    end
    destroy
  end
def destroy_and_clean if domains_present? errors . add ( :domains , :exist ) return false end destroy end
TODO: refactor, it should not allow to destroy with normal destroy,
no need separate method
should use only in transaction
TODO : refactor it should not allow to destroy with normal destroy no need separate method should use only in transaction