<commit_before>module ElasticsearchAutocomplete
  class Railtie < Rails::Railtie
    initializer 'elasticsearch_autocomplete.model_additions' do

      if defined?(Mongoid::Document)
        ActiveSupport.on_load :mongoid do
          Mongoid::Document.send :include, ElasticsearchAutocomplete::ModelAddition
        end
      else
        ActiveSupport.on_load :active_record do
          ActiveRecord::Base.send :include, ElasticsearchAutocomplete::ModelAddition
        end
      end

    end
  end
end<commit_msg>fix mongoid initializer hook<commit_after>module ElasticsearchAutocomplete
  class Railtie < Rails::Railtie
    initializer 'elasticsearch_autocomplete.model_additions' do

      if defined?(Mongoid::Document)
        ActiveSupport.on_load :mongoid do
          Mongoid::Document::ClassMethods.send :include, ElasticsearchAutocomplete::ModelAddition::SingletonMethods
        end
      else
        ActiveSupport.on_load :active_record do
          ActiveRecord::Base.send :include, ElasticsearchAutocomplete::ModelAddition
        end
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.06290471785383904, 'fraction_numerical': 0.0, 'mean_word_length': 3.5083333333333333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '6426940', 'n_tokens_mistral': 299, 'n_tokens_neox': 286, 'n_words': 60}