Add comments to ALL models (ie automatically add has_many)

I have the acts_as_commentable and a bunch of others added to pretty
much every model, is there a way to automaically add these to EVERY
model ?

I tried the following but it fails with an error…

ActiveRecord::Base.class_eval do
has_many :notes, :as => :model_with_notes, :dependent => true
end

fails with…
/usr/lib/ruby/gems/1.8/gems/activerecord-1.15.6/lib/active_record/
base.rb:1369:in class_of_active_record_descendant':NoMethodError: undefined methodabstract_class?’ for Object:Class

On Jan 8, 12:21 pm, uncle [email protected] wrote:

I have the acts_as_commentable and a bunch of others added to pretty
much every model, is there a way to automaically add these to EVERY
model ?

Without knowing the details, I would suggest using inheritance.
Instead of trying to change ActiveRecord::Base, just derive a new
class from it to hold all the common stuff, then derive your models
from that class.

///ark