On 16.03.2009, at 10:50, Bryan wrote:
> Apart from dm-is-remixable. I kinda like having ONE 'comments' table > rather than 5. I've looked at serveral solutions but none of them seem > to work (outdated maybe). > I used dm-is-remixable and plain Ruby modules, and happy to not even bother with polymorphic associations in the first place. Polymorphic associations are cocain of ORM world, "kinda nice" and "cool kids use them" and "caused you no harm yet" until it is too late. Having just one table instead of N is not that useful from practical point of view. I personally only find object level polymorphism important, and how to share bits of behavior with modules, and not what tables those objects go to sleep to. After all, the whole point of DM is to hide storage details from you. http://gist.github.com/cef3c9bf2f756779aca2 This is callback methods idiom. It is useful in many simple cases with lazy module evaluation trick. Here callback methods approach won't work since you need to specify option for each macro call. class Widget is :state_machine, :field => :activation is :state_machine, :field => :face end Macros have only one advantage: if you have multiple associations of the same kind, you need options for each call and not one set of callback methods per class. Hope this helps. MK --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
