datamapper / dm-is-remixable

dm-is-remixable allow you to create reusable data functionality
http://datamapper.org/
MIT License
13 stars 5 forks source link

dm-is-remixable: allow belongs_to #12

Open solnic opened 13 years ago

solnic commented 13 years ago

dm-is-remixable does not allow belong_to relations (and I guess, but haven't tested, neither has-1/n relations). Is that by design?

Workaround is to use enhance at the places where you remix the remixable, but that is quite repetitive.


Created by Lawrence Pit - 2008-10-24 11:36:07 UTC

Original Lighthouse ticket: http://datamapper.lighthouseapp.com/projects/20609/tickets/612

solnic commented 13 years ago

Its because #belongs_to and #has are class methods, so when you do belongs_to :my_obj your calling that on that particular module.

Should remixable define its own belongs_to and has that it calls on anything that remixes it?

by coryodaniel

solnic commented 13 years ago

I think I have a better idea: I have a class called deferred module that allows you use any class methods on hosting class since body of module is evaluated only on inclusion. I will port it to Extlib shortly.

by Michael Klishin (antares)

solnic commented 13 years ago

I will start working on a "new" dm-is-remixable pretty soon. Ted Han and I both want to make the API more "has" like, and will definitely have a look at incorporating extlib/lazy_module to allow for association definitions right inside the remixable module.

by Martin Gamsjaeger (snusnu)

solnic commented 13 years ago

In the meantime I’ve started work on my dm-is-remixable implementation but I got sidetracked and so things currently aren’t totally useable atm. I’m marking this as a suggestion for now to remind me that the new version should support this, but to not stand in the way of open tickets. I don’t think that feature request will ever make it into the current implementation of dm-is-remixable (unless someone else is willing to provide it).

by Martin Gamsjaeger (snusnu)