Ruby get inheriting class
- by Brian D.
I'm working on creating my first plugin for rails. I'm still pretty new to ruby and I was wondering if its possible to get the inheriting class?
For example, I'm trying to create a plugin that will allow unit testing and functional testing when you are not using migrations. What I'm trying to do is initialize a class variable named controller to be initialized to the type of controller that is being tested.
If I have a base class ControllerTest:
class ControllerTest < Test::Unit::TestCase
attr_accessor :controller
def initialize
super
@controller = "call function that will find the inheriting classes name and create an instance of that controller type."
end
end
So what I'm currently stuck on is getting the name of the inheriting class. Is this possible? And if not, does anyone know another way on how I could go about implementing this?
Thanks in advance.