From: Hoss Firooznia Date: 2001-08-14T12:48:08+09:00 Subject: [ruby-talk:19667] Re: Inheritance problem with PostgreSQL extension Guy Decoux writes: > * the second is to consider that ::new not only make memory allocation but > also perform an initial setup, #initialize in this case is used to do > an extra setup. > > For postgres, this is the second choice and the initial setup is the > connection to the database. This mean that in your case you must not > redefine #initialize, but redefine ::new. > class MyPGconn < PGconn > def self.new [...] Thanks very much, Guy! This is tremendously helpful. One thing I don't quite understand, though, is why "self.new" works when just "new" doesn't. Isn't the "self" implicit? Shouldn't "def new" override the definition of "new" in the ancestor class? By the way, I'm right in the middle of Thomas and Hunt's excellent "Programming Ruby", so please feel free to ignore this question if it's something that should become self explanatory soon -- I'll RTFM. :-) Thanks, - Hoss