Reputation: 711
i have an asset class which have type, name, label etc.
Asset types are: avatar, image, video, summary etc.
I want to have Video < Asset type only for type = 'video', but for all other types - Asset should be used.
If i use self.inheritance_column = 'type' - it fails, because cant find Avatar class. Is there any approach how to map all types to Asset class except video?
Thanks, Kirill Salykin
Upvotes: 0
Views: 169
Reputation: 43103
That won't work. You're either doing STI with those types or you aren't.
The way to do it is use type
as your STI column, and something like asset_type
as your categorization column. Then only video gets the type
column, all other assets use the asset_type
column to tell what's what.
Upvotes: 1