Hey OP dm-is-remixable give you multi table inheritance. Here is a blog post on it you can also hit me up if you have any specific questions, though the readme and rspecs have a bunch of examples.
http://blog.vokle.com/index.php/2008/08/22/modular-tables-datamapper-is-remixable/ On Jan 11, 1:35 pm, ravinggenius <[email protected]> wrote: > I copied the module code modified my Part class to look like that. > Then I updated TextPart, TablePart, etc to include Part, instead of > DataMapper::Resource. However running rake db:automigrate results in > the following error: rake aborted! undefined method `properties' for > Part:Module > > As I understand it, dm-is-remixable does more or less what your code > would do. I was was really wanting a parts table to hold the common > properties, plus that would give me a single, unified part_id to > reference. > > Another technique I thought of was to have two properties on the Part > model, one for the part-type's name (like Discriminator does) and > another for the part-type's id. Then I would have a load method in > Part. Would there be any particular reason why I wouldn't want to do > this? > > By the way what is your code doing on line 15? I didn't really > understand that bit. > > > What you want to do is really simple using a Module to define the > > properties and then including that module inside each Model that needs > > it, like this: > > >http://gist.github.com/45667 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
