Why polymorphic association doesn't work for STI if type column of the polymorphic association doesn't point to the base model of STI?

前端 未结 7 2039
旧时难觅i
旧时难觅i 2020-12-02 12:07

I have a case of polymorphic association and STI here.

# app/models/car.rb
class Car < ActiveRecord::Base
  belongs_to :borrowable, :polymorphic => tru         


        
7条回答
  •  既然无缘
    2020-12-02 12:57

    There is a gem. https://github.com/appfolio/store_base_sti_class

    Tested and it works on various versions of AR.

提交回复
热议问题