I'm about to start developing an e-commerce, but I'm caught up in the issue of modeling, especially in product categories and subcategories. For example. A category can have several sub-categories. Each sub-category may also have sub-sub-categories (maximum of 3 levels). More or less like this:
-Categoria
--Sub Categoria
---Sub-sub categoria
What would that look like in the database? Was it a self-relationship? If yes, or if not, can someone give an example?
Another doubt. Example:
Vestiário
-- Camisetas
-- Masculino
---- Camiseta M. pollo tam. G (produto)
If this shirt belongs to men, then it automatically percends the shirts and apparel. I will use Rails, how would I implement this kind of behavior there?