Database design for attribute attributes, polymorphism or STI

I am struggling with a database architecture solution for a Rails application.

We have many different organizations, and each organization has marketing assets that they can sell. Examples of these marketing assets include:

  • Banners
  • Knitwear
  • Web banners
  • Emails

Each of these objects has different properties. The banner has attributes of height, width, placement. A jersey has a logo type, placement, and logo type attributes.

What would be the best way to implement this? I thought:

  • Attributes on the model of organization are random, difficult to maintain, and apparently violate the principle of shared responsibility.
  • Polymorphic association. The specificity of each asset makes me think that this is a wrong implementation either
  • - . , , "", . , , .

- ? -, , .

+4

Source: https://habr.com/ru/post/1676085/


All Articles