I’m trying to find a solution to this modeling problem I’m having in
Rails, mainly because of the lack of support for ClassTI in Rails.
I’m building a highly complex CMS which will be handling different
types of content groups (objects) which each have their own unique set
of attributes. For example:
class Product < ActiveRecord::Base; end
class Game < Product; end;
class Movie < Product; end;
class Car < Product; end;
Normally this can be handled fine by STI but each model has a very
unique set of attributes.
product attributes:
- id
- title
- description
- created_on
- updated_on
game attributes:
- id
- title [inherited]
- description [inherited]
- esrb_rating_id
- game_platform_id
- created_on [inherited]
- updated_on [inherited]
movie attributes:
- id
- title [inherited]
- description [inherited]
- mpaa_rating_id
- production_studio_id
- created_on [inherited]
- updated_on [inherited]
car attributes:
- id
- title [inherited]
- description [inherited]
- mpg_city
- mpg_highway
- created_on [inherited]
- updated_on [inherited]
Can anyone suggest a good solution for me that will allow me to still
keep a DRY environment?