<commit_before>require "active_model"
require "active_model/serializer"

ActiveModel::Serialization.class_eval do
  extend ActiveSupport::Concern

  module ClassMethods #:nodoc:
    def active_model_serializer
      return @active_model_serializer if defined?(@active_model_serializer)

      # Use safe constantize when Rails 3.2 is out
      begin
        @active_model_serializer = "#{self.name}Serializer".constantize
      rescue NameError => e
        raise unless e.message =~ /uninitialized constant$/ && e.name.to_s == "#{self.name}Serializer"
      end
    end
  end

  # Returns a model serializer for this object considering its namespace.
  def active_model_serializer
    self.class.active_model_serializer
  end
end

begin
  require 'action_controller'
  require 'action_controller/serialization'

  ActiveSupport.on_load(:action_controller) do
    include ::ActionController::Serialization
  end
rescue LoadError => ex
  puts ex
  # rails on installed, continuing
end<commit_msg>Remove puts<commit_after>require "active_model"
require "active_model/serializer"

ActiveModel::Serialization.class_eval do
  extend ActiveSupport::Concern

  module ClassMethods #:nodoc:
    def active_model_serializer
      return @active_model_serializer if defined?(@active_model_serializer)

      # Use safe constantize when Rails 3.2 is out
      begin
        @active_model_serializer = "#{self.name}Serializer".constantize
      rescue NameError => e
        raise unless e.message =~ /uninitialized constant$/ && e.name.to_s == "#{self.name}Serializer"
      end
    end
  end

  # Returns a model serializer for this object considering its namespace.
  def active_model_serializer
    self.class.active_model_serializer
  end
end

begin
  require 'action_controller'
  require 'action_controller/serialization'

  ActiveSupport.on_load(:action_controller) do
    include ::ActionController::Serialization
  end
rescue LoadError => ex
  # rails on installed, continuing
end
{'fraction_non_alphanumeric': 0.07381193124368049, 'fraction_numerical': 0.0020222446916076846, 'mean_word_length': 4.180628272251309, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3494210', 'n_tokens_mistral': 568, 'n_tokens_neox': 558, 'n_words': 150}