开发者

is single table inheritance (STI) available when using polymorphism in mongoid?

开发者 https://www.devze.com 2023-03-31 17:43 出处:网络
When using STI and polymorphism in ActiveRecord, the following is needed to ensure that :dependent => :destroy

When using STI and polymorphism in ActiveRecord, the following is needed to ensure that

:dependent => :destroy

will work properly:

开发者_JAVA百科
def attachable_type=(sType)
    super(sType.to_s.classify.constantize.base_class.to_s)
end

Has anyone been using STI and polymorphism successfully with Mongoid?

0

精彩评论

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

关注公众号