I'm relatively new to ruby on rails and I need some help to model the following scenario:
- The model contains Products and Services
- A Service must be provided by a Product (it cannot exist without a provider/owner)
- A Product can provide zero, one or many Services
- A Product can consume zero, one or many Services
- The provider (Product) can but is not automatically a consumer of the provided Service
Whats the best use of associations to be able to get:
- provided Services (from Product)
- consumed Services (from Product)
- consumers of the Service (from Service)
- the providing Product (from Service)
The problem is similar to this one Many-to-many Users and groups, but groups have owners (Users and Groups with Owner). But my Product is not necessarily a consumer of the provided Service.
Any help would be greatly appreciated!