Hi Luca,
> But I can''t get the method to be inserted into my class. I
> thought something like class MyClass < AR::Base
> include(ViewCTI)
> end
> or
> class MyClass < AR::Base
> self.extend(ViewCTI)
> end
> should do it, but it doesn''t look that way. Is there a
> method to import the module methods into the class?
I''m still new at this Ruby thing myself, so I could be wrong. Try
module ViewCTI
def instantiate(record)
...
end
end
class MyClass < ActiveRecord::Base
extend ViewCTI
end
Depending on what you are trying to do, it may be more appropriate to do
this:
module ActiveRecord
class MyBaseClass < ActiveRecord::Base
def self.instantiate(record)
...
end
end
end
class MyClass << ActiveRecord::MyBaseClass
...
end
I''m currently using both techniques to override other AR methods with
great
success.
Adelle.