I have a site which has both articles and photos embedded in each article. I want to allow people to comment on both a particular article itself as well as on an individual photo in an article. My questions is: What''s the best design for the DB model - one Comments table with a flag to say if the comment was on an article or a photo or two separate tables - one for comments on articles and the other for comments on articles? What''s a good naming convention for these tables? I realize there may be no single correct answer but I am hoping to get some good suggestions/ideas. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''ll correct some spellos first 1. My question is... 2. One for comments on articles and the other for comments on photos. On Nov 7, 11:38 am, raghus <raghu.sriniva...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have a site which has both articles and photos embedded in each > article. I want to allow people to comment on both a particular > article itself as well as on an individual photo in an article. > > My questions is: What''s the best design for the DB model - one > Comments table with a flag to say if the comment was on an article or > a photo or two separate tables - one for comments on articles and the > other for comments on articles? What''s a good naming convention for > these tables? > > I realize there may be no single correct answer but I am hoping to get > some good suggestions/ideas.--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Have you looked into polymorphic associations? Fred On 7 Nov 2007, at 19:40, raghus wrote:> > I''ll correct some spellos first > 1. My question is... > 2. One for comments on articles and the other for comments on photos. > > On Nov 7, 11:38 am, raghus <raghu.sriniva...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> I have a site which has both articles and photos embedded in each >> article. I want to allow people to comment on both a particular >> article itself as well as on an individual photo in an article. >> >> My questions is: What''s the best design for the DB model - one >> Comments table with a flag to say if the comment was on an article or >> a photo or two separate tables - one for comments on articles and the >> other for comments on articles? What''s a good naming convention for >> these tables? >> >> I realize there may be no single correct answer but I am hoping to >> get >> some good suggestions/ideas. > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---