From: Alfredo Garcia lopez Date: 2008-10-22T22:18:56+09:00 Subject: Include code (conditionally) in a class and its subclasses Hi. Is there a way to include code in a class and all its subclasses and get the behaviour as if it was included at the end of the code in each of them? Example: class Product120 or even module ProductExtension def precio old_price+30 end alias_method :old_price, :price alias_method :price, :old_price end @product=Product.new @product.price =>130 The module to include would be conditional. Ex: If the current class is Product I would include ProductExtension. If the current class is Category I would include CategoryExtension. Perhaps there卒s a better way to chieve this.Accept suggestions. Thanks for reading. -- Posted via http://www.ruby-forum.com/.