I have the following entities:
Product, Supplier. Manufacturer < Supplier and Vendor < Supplier.
Product has_many suppliers through products_suppliers
The thing is, the type of the supplier will depend on the product –
the requirement. So, that’s why I though the type information should be
the products_suppliers entity.
What I would like to happen is, when a supplier is retrieved using the
@suppliers = @product.suppliers.all
Somehow hook up AR and look into the type attribute of the
products_suppliers association and for each record, instantiate the
class (either Vendor or Manufacturer).
It’s STI, only that the type data is in another realm and is “variable”
(depending on the product).
Is there a way to do that with the current STI implementation in Rails
2.2.2? If not, how could I hook up AR to make it happen? Or do you
Any suggestions appreciated.