Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
This paste will be private.
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' #
From the Design Piracy series on my blog: