Inheritance and polymorphic-associations in rails

前端 未结 1 1766
轻奢々
轻奢々 2020-12-29 17:14

I have a User model, which belongs to Profile (belongs_to polymorphic). One model comes in two subclasses, but the profile_type in

相关标签:
1条回答
  • 2020-12-29 18:05

    This happens because the _type column is supposed to identify the model's table and should not contain data on the model itself - just a reference.

    However if you inspect user.profile.type it should return SomeDeepProf1.

    0 讨论(0)
提交回复
热议问题