how to fetch hierarchy of my model in rails
This is my common model which has no table.
class CommonActiveRecord < 开发者_如何学运维ActiveRecord::Base
self.abstract_class = true
def before_validation
set_blank_attributes_to_nil(@attributes)
end
end
My other models look like this ..
class BalanceName < CommonActiveRecord
def before_validation
super
end
end
I want to fetch all superclasses of BalanceName..
This command is returning only one level superclass
>> BalanceName.superclass
=> CommonActiveRecord(abstract)
how may i get hierarchy of superclasses ??
BalanceName.ancestors will give you an array of all superclasses
精彩评论