I am starting my store application again for the 3rd time, I am just
trying to get eveything right so that I don’t come up with any more
complex problems later. Hopefully someone can steer me in the right
I have a store that sells lots of types of product.
e.g. CDs, T-Shirts, DVD
Each product type has different associations.
Cds - multiple artists, multiple genres, multiples record labels
T-Shirts - one artist
DVD - one artist, one video format (NTSC, PAL)
My problem is that while these product types and have different
characteristics are all still products, I am wondering if there is any
benefit in using Polymorphic Assocations to link these all together as
Products or if I have misunderstood the reasons for using them in the
first place. I have read a link that recommends them for this but
nothing to demonstrate this actually in practice by anyone.
I wonder if, when I have actually been able to implement this I will be
able to use them like so
artist = Artist.find(1)
artist.products.each do |p|
blah blah blah
To be honest many of the explanations I have read on Polymorphic
Associations have left me a little bewildered. I am sure once I get them
working the concept won’t seem so alien.