On 25 September 2013 11:34, <[email protected]> wrote: > Hi there. I'm making my first rails app and taking Hartl's tutorial app as > my starting point. All the features he implements are things I want. > > Primarily the site wants to be a collection organising site. I'll be adding > a table of ITEMS, and USERS can add those ITEMS to their collection or to > their wantlist. > > What I'm trying to decide is where best to put the "who has what" > information. It seems to me that doing it all in the USERS or ITEMS table > might be a bit cumbersome. For instance an ITEM "has many" USERS with a long > list of them, or a USER "has many" ITEMS, again with a long list.
If a user can have many items, and each item can be associated with many users then neither of those will work. > > Would it be better to use "has many through" with an OWNERSHIP or COLLECTION Yes, if the relationship requires it (see above). > model/table? > I'm thinking along the lines of > 1, USER 5, ITEM 322, WANTLIST > 2, USER 9, ITEM 27, COLECTION > 3, USER 6, ITEM 90, COLLECTION I don't understand what WANTLIST COLECTION and COLLECTION mean here. > etc > > If this is a better idea would it make more sense to give WANTLIST a > seperate model/table? > > I'm trying to work out what would be the most efficient way of doing it. > They want to be easily indexable so that you can have "USER has 378 ITEMS" > and the like. current_user.items.count Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsMH6MH407GWwv%2BjtSzHkf73aPEBohLv8rO1fdzhRyWbg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.

