Hi Piotr, You could have a look at http://github.com/snusnu/dm-is-commentable/tree/master
Although my approach uses dm-is-remixable and thus generates an extra table for every one of your commentable models, you won't have to deal with these tables in the model layer, i.e. you don't need to specify separate models for these tables as dm-is-remixable handles this for you. All you need to do is define your models like so: class Article # properties is :commentable end Most of the api you need should be available on the Article model. In my opinion, this is a nice compromise between the easy use of polymorphism and the classic relational approach. This way you have all the benefits of relational database design, while not having to deal with superfluous join models in your models directory. Let me know what you think cheers snusnu On Sat, Jan 3, 2009 at 23:52, Piotr Sarnacki <[email protected]> wrote: > > Hi, > > I've found this qoute in dm-polymorphic README: > "It has been decided that DM will not follow this path, since it > really isn't very nice on the DB and there are other ways, that do not > require DBA to cry to achieve the same result." > http://github.com/hassox/dm-polymorphic/tree/master > > By the way, what's DBA? :) > > I need dm plugin allowing to add comment to any model (I write > application in which several, probably 4-5, models will have > comments). I know that polymorphism has some drawbacks but it's also > easier to maintain, without gazilions of additional tables (dm-tags > uses it, I can't imagine any other simple way of developing it). > > Is there any other way to make such a plugin (comments or tags) > without polymorphism and creating table for each model? > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "DataMapper" 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/datamapper?hl=en -~----------~----~----~----~------~----~------~--~---
