<commit_before>module Immortal
  module SingularAssociation

    def with_deleted_reader(force_reload = false)
      deleted_reader('with', force_reload)
    end

    def only_deleted_reader(force_reload = false)
      deleted_reader('only', force_reload)
    end

    private

        def deleted_reader(how, force_reload = false)
          klass.uncached do
            send(:"find_#{how}_deleted_target")
          end
        end

        def find_with_deleted_target
          klass.unscoped do
            scoped.first.tap { |record| set_inverse_instance(record) }
          end
        end

        def find_only_deleted_target
          klass.unscoped do
            scoped.where(:deleted => true).first.tap { |record| set_inverse_instance(record) }
          end
        end

  end
end<commit_msg>Reset scope before calling deleted finder<commit_after>module Immortal
  module SingularAssociation

    def with_deleted_reader(force_reload = false)
      deleted_reader('with', force_reload)
    end

    def only_deleted_reader(force_reload = false)
      deleted_reader('only', force_reload)
    end

    private

        def deleted_reader(how, force_reload = false)
          reset
          reset_scope

          klass.uncached do
            send(:"find_#{how}_deleted_target")
          end
        end

        def find_with_deleted_target
          klass.unscoped do
            scoped.first.tap { |record| set_inverse_instance(record) }
          end
        end

        def find_only_deleted_target
          klass.unscoped do
            scoped.where(:deleted => true).first.tap { |record| set_inverse_instance(record) }
          end
        end

  end
end
{'fraction_non_alphanumeric': 0.06670637284097677, 'fraction_numerical': 0.0, 'mean_word_length': 2.187855787476281, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3206668', 'n_tokens_mistral': 488, 'n_tokens_neox': 483, 'n_words': 100}