Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4628

Polymorphic Models in Ruby on Rails?

$
0
0

For a project I'm working on, the store has two types of products - a real product and a group of products.

For this discussion, let's call them "1 T shirt" and "a box of T shirts". For one t-shirt, I need to store the normal attributes - price, sku, size, color, description, etc. For the box of t-shirts I need to have a price, sku, description, and a list of t-shirts that are included.

So right now, I'm representing this with the Shirt and ShirtCollection models. I can see this causing difficulty down the road when I need to do reporting and order management and making sure SKUs are unique.

So what's the best way of representing this?


Viewing all articles
Browse latest Browse all 4628

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>