class RegisteredModels
  cattr_accessor :models
end

RegisteredModels.models = []

module ModelRegistration
  def self.included base
    base.extend ClassMethods
    base.instance_eval do
      alias_method_chain :inherited, :registration
    end
  end

  module ClassMethods
    def inherited_with_registration sub
      RegisteredModels.models << sub
    end
  end
end

ActiveRecord::Base.send :include, ModelRegistration


# #./script/../config/../config/../vendor/rails/activerecord/lib/../../activesupport/lib/active_support/core_ext/module/aliasing.rb:28:in `alias_method':NameError: undefined method `inherited' for class `ActiveRecord::Base'
#