What are the possible solutions to OO/Table inheri

2019-07-13 10:21发布

These are the options I see that can help solve "Rails 5 - Object Relation Impedence and how to structure multiple inherited classes/tables" TL;DR - the Object Table Impedance ORM problem.

  1. Abstract base class, with each child class having its own table (ie storing the common attributes for each type in its own table)

  2. STI, just put everything in one Base class and Table, and create all child attributes in that table, but have the sub-classes (ie your other Rails models) inherit from that Base Class.

  3. Sequel db (supports Class Table Inheritance)

  4. Dan Chak's 'Enterprise Rails' solution (here), seems quite old but looks promising

  5. Composition

Are there any others?

0条回答
登录 后发表回答