<commit_before>require 'rolify'
require 'rails'

module Rolify
  class Railtie < Rails::Railtie
    initializer 'rolify.initialize' do
      ActiveSupport.on_load(:active_record) do
        ActiveRecord::Base.send :extend, Rolify
      end
      
      config.after_initialize do
        ::Mongoid::Document.module_eval do
          def self.included(base)
            base.extend Rolify
          end
        end
      end if defined?(Mongoid)
    end
  end
end<commit_msg>Extending Mongoid::Document before other rails plugins access models<commit_after>require 'rolify'
require 'rails'

module Rolify
  class Railtie < Rails::Railtie
    initializer 'rolify.initialize' do
      ActiveSupport.on_load(:active_record) do
        ActiveRecord::Base.send :extend, Rolify
      end
      
      config.before_initialize do
        ::Mongoid::Document.module_eval do
          def self.included(base)
            base.extend Rolify
          end
        end
      end if defined?(Mongoid)
    end
  end
end
{'fraction_non_alphanumeric': 0.07171314741035857, 'fraction_numerical': 0.0, 'mean_word_length': 2.4655172413793105, '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': '3267704', 'n_tokens_mistral': 299, 'n_tokens_neox': 287, 'n_words': 74}