Adam Akhtar wrote: > > Marnen many thanks again for your help. You're welcome.
> So if i sort them by their name then id, and I have A and B with ids 1 > and 2 respectively then in my pairing controller id do > @pairing = Pairing.new(params[:pairing]) > @pairing.save (Which would use the callback before_create above) > > So A has an Ingredient_Partner B > i.e. A.alphabet_partners ===> B That's right. > > But would it work the other way i.e. > B.alphabet_partners ==> A ????? > > i thought it wouldnt without creating a 2nd pairing with the letters > switched. Look at the code I gave you, and think about how it would behave. Better yet, write some tests and try it! Ask the computer, not me. :) Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---