Hey guys, First off, thx for bringing up a somewhat interesting discussion! However, I still hope that maybe someone also bothers to answer my original question :-)
Concerning your questions on the usefulness of namespaced models. Well, modules are a powerful feature of ruby, and one possible use for them is to keep namespaces clear and separated. That said, I just want to do that, keep my namespaces separate and clear and prevent myself from possible name clashes. Imagine using a merb slice that has a model named the same like a model in the main app. Note that this really doesn't mean that the underlying table _must_ be named according to the conventions, or even that both tables have the same name. As long as the models have the same name and/or the tables have the same name, there is a problem. Now if all the slice models are namespaced, all I have to care is that my other model is not in the same namespace/module (if it would need to be, and it still has the same name, there is some kind of domain model problem anyway). I must say that I also like the current datamapper/extlib naming conventions, that produces a 'shop_products' table out of a Shop::Product model. This takes the preventing of the name clash down to the database layer in a scalable manner. I also don't really see a point in modules mapping to repository names, how would you handle multiple nestings then? (e.g. Shop::Accounting::Address). I think my opinion on namespaced models is the following. It's standard ruby to use modules also for namespacing reasons, and I think that's a good practice! With that in mind, there is no reason I can see why merb shouldn't allow me to write the ruby I like to write, especially if the existing conventions cover (most things) nicely and it's really not that hard! Furthermore, this very concept of namespaced models can actively help in preventing nameclashes, and that's a good thing imo. Again, anyone got an opinion on my original question concerning the CSS3 id-selectors ? cheers snusnu On Fri, Dec 12, 2008 at 11:08, jonuts <[email protected]> wrote: > > > > On Dec 12, 11:19 am, Roy Wright <[email protected]> wrote: >> I wrote a rails app a while back that connected 5 legacy databases >> (total 273 tables). There were a couple of tables with identical names >> in different databases. I used a namespace for each database, which >> worked well except for a couple of external tools I tried that just >> didn't handle namespaces. If I was to do it again, I'd probably just >> name my models by prepending the database name to the table name and >> forgo namespaces. >> >> Just my 2 cents... > > Well, that was sort of my point. Putting a model under a module makes > sense when dealing with multiple databases, but merb doesn't handle > those situations as well as one (er, *I* at least) would expect. I > just use your suggestion of prepending the db name to the model class > name and that has worked fine. But I would like to know what "The" > correct way of handling a situation like that is. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "merb" 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/merb?hl=en -~----------~----~----~----~------~----~------~--~---
