Adam Akhtar wrote:
Hi if i have one model say with objects for each letter of the alphabet
e.g a,b,c ... x,y,z and i want to allow users to create there own
favourite pairings of these e.g.
ab, cd, ef, gp and allow them to discuss via comments on each pairing,
whats teh best way to model this in rails?
Use a Pairing class with a polymorphic association.
the order of teh letters DOESNT matter so ab IS the SAME as ba. Id
rather avoid duplication in my "Pairings" table because that would mean
id have to assign user commments to both ab and ba.
Sort the object IDs in some unambiguous way before creating a pairing.