Modelling DB Structure - Rails

Viewed 27

I have a product model wherein the user can customise the product being selected. The user can actually customise the product on two fronts namely size and color. Size options as of now is currently of two types namely size1 and size2. Color options are also similar to that of size where user can select between Black and White irrespective of frame size chosen for now. How can the variant data be modelled effectively in a rails environment? I am looking for the best solution keeping in mind the options for both size and color might grow in the near future. Please let me know what would be the best way to address this?

1 Answers

Here is a class diagram which can help you understand how you should build relationship.

enter image description here

Size and Color will be option_types, size1, size2, Black, White etc will go into option_values

variants with option_value_variants will hold variants like Black Shirt of Size1

Related