Hi Thanks for your reply and your suggestions. Im a bit confused, could you help clarify the following -
>> 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. I thought polymorphic associations are used when you have several different models which have the same relationship with anohter one. I.e. You want to have comments associated with your models for Photos, Posts and Products for example. In this case however only my alphabet model has a relationship with the pairings model. So im not sure how i implement a polymorphic association here and how that that allow me to create only one pairing record to represent ab or ba. my current setup is class Pairing < ActiveRecord::base belongs_to :alphabet belongs_to :alphabetpartner, :class_name => "Alphabet", :foreign_key => "alphabetpartner_id" class Alphabet < ActiveRecord::Base has_many :pairings has_many :alphabetpartners, but this requires me to create two records in hte pairings table for ab and ba. >> 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. Can you explain more about what you mean here and are you saying that i have to have two pairs in my pairing table for ab and ba? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

