Apple < ActiveRecord:Base
Orange < ActiveRecord:Base
piece_of_fruit = Apple.new
I want to know whether piece_of_fruit
is an Apple
or an Orange
- even though both are derived from ActiveRecord:Base
.
Is there a reflection method that will tell me the next class in the inheritance tree (Apple/Orange).
What about if I want to look at each successive step in the inheritance hierarchy after that, starting with ActiveRecord:Base in this case?