开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜