From: Caleb Clausen Date: 2009-09-14T02:42:33+09:00 Subject: Re: module to overwrite method defined via define_method On 9/13/09, Gaspard Bucher wrote: > Damned ! This means that all the dynamic methods created by rails with > "has_one" and such cannot be overwritten by including a module except if > you write: > > module A > def self.included(base) > base.send(:define_method, 'foo') do > puts "'foo' from A" > end > end > end > > Any other solution ? If you use extend instead of include, the methods in the module should be seen first. Extend operates on instances, not classes, tho, so you'll have to call extend in your initialize. Alternately, if you make a subclass and then use include in the subclass, I believe that will also utilize the module version. Not sure how that might interoperate with rails.