module ActsAsParanoid::AssociationReflection

def can_find_inverse_of_automatically?(reflection)

def can_find_inverse_of_automatically?(reflection)
  options = reflection.options
  if reflection.macro == :belongs_to && options[:with_deleted]
    return false if options[:inverse_of] == false
    return false if options[:foreign_key]
    !options.fetch(:original_scope)
  else
    super
  end
end

def scope_allows_automatic_inverse_of?(reflection, inverse_reflection)

def scope_allows_automatic_inverse_of?(reflection, inverse_reflection)
  if reflection.scope
    options = reflection.options
    return true if options[:with_deleted] && !options.fetch(:original_scope)
  end
  super
end