On 4 Sty, 00:23, "Martin Gamsjaeger" <[email protected]> wrote:
> Hi Piotr,
>
> You could have a look athttp://github.com/snusnu/dm-is-commentable/tree/master
Thanks, I don't even try to guess why I haven't found that myself (I'm
pretty sure I was looking for such a plugin).
> 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
>
I've read your thoughts in readme and your mail and I think it is good
approach. I like the idea of dm-is-remixable, but I can't really say
which way I would go. I will have to rethink it with remixable added
to possible options :)
Thanks for the plugin, I'll probably use it. Unless I will take
polymorphic approach ;-)
One more drawback I can see with remixable - sometimes projects change
very often and with many tables generated with auto_migrate it's a lot
harder to maintain changes.Thankfully there is auto_upgrade method in
datamapper, so adding new columns is not destructive. It would be
harder with altered columns, but it doesn't happen that much.
You made good point about fetching all associated records with one
query. I think I will need some kind of geolocalization for several
models, so probably I will need to go polymorphic way to gain the
ability to easily display all these data on one map.
Thanks for you answer
cheers :)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---