The problem is that the second class which I want to use is derived
from the ActionController::Base. I cannot make that class into a
module otherwise I would be disturbing a the functionality of the
Rails Application.
No, you make a new module, take out the methods from the class which is
derived from ActionController::Base which you want to reuse, put them in
the module, then require and include the module in the controller class
and also your new class. Do the same with the other class (into a
separate module). You end up with two modules, two existing classes
which each include their necessary module and your new class includes
both modules:
module AModule
end
class A
include AModule
end
module BModule
end
class B < ActionController::Base
include BModule
end
# Then the new class:
class C
include AModule
include BModule
end
Alternately, you just refacter one class, creating one module, and
include that module in your new class and inherit from the other class:
module AModule
end
class A
include AModule
end
class B < ActionController::Base
end
# Then the new class:
class C < B
include AModule
end
If you don't have access to refacter either class, then you can't do it.
M