Hello - I'm something of a newbie to both Ruby and Rails, and the project I've dreamt up is rather large and unusual, so I'm taking things slowly - doing tutorials, experimenting on the side, and so on. Now, I'm trying to figure out what classes I should have for my project, and what their associations will be, but I'm not sure what would be the most efficient and practical, so I'm hoping someone can give me a little advice. The basic concept is that of a set of interrelated wikis. Each user has their own individual private wiki, and then there's a public wiki that everyone has access to. All these wikis share a common set of pages, so a user can be browsing and editing an article on their private wiki, and use a tab at the top of the screen to flip over to the public wiki to see what other users have written on the same subject, possibly edit that (if they feel they have something to contribute) and so on. In addition, people would be able to create/upload other items to individual articles on the wiki. These might be images, pdfs, bits of text, whatever - it's supposed to be flexible, and I plan on building a list of the possibilities, but I'm not quite there yet. So a few different people might upload supplementary objects that are then associated with a specific article (or category of articles) on the public wiki. Then, users browsing that article may peruse the supplementary objects uploaded there, and if they see one they like, they can click a link and import it to their own wiki. Over time, then, they can amass a collection of supplementary materials that they've chosen specifically from a common pool, and organize and view them using the same categories used for the articles. I know this probably sounds like a big, horrific Rube Goldberg-esque contraption doomed to failure, which is why it's all the more important to plan it out in advance in such a way that it won't set my server on fire or something. So, my question is, what's the best way to set up my classes and associations and whatnot so that I can keep the database mangling and trickiness to a minimum? I don't think that having a single "Entries" table that will contain all the entries of each individual would be very practical - it seems to make more sense to me to have those two entries linked by a common id number across distinct tables. But just creating a table for public entries and another for private ones doesn't seem like much of an improvement - the latter would still be obscenely large. If there's a mechanism through which Rails can create a new entry table on the fly for each individual user that's created, I haven't heard of it, and that doesn't sound very plausible either. Then there's the other objects - to pick one, suppose that I have a table with the relevant information of all the uploaded images on the site - their URLs, what articles or categories they're attached to, and so on. If a user wants to display a list of all the images they've tagged to appear in their wiki - or more likely, all of the images that they've tagged that are associated with a certain category of entry - can a join table be set up to provide that information in a reasonably efficient manner? This might all sound like insanity, and maybe it is, but at least it might give somebody a challenge, hmm? A straight answer would be great, but if somebody has a link to someplace I can learn more about these sorts of issues, that would be just as appreciated. Thanks!
on 2009-01-05 00:52