The short question: How do I execute custom code RIGHT after attributes are loaded from the data store?
The long version: I thought hooks would be the place to look, but after looking through the code and trying to find a way, it looks like hooks won't do what I want since instance hooks appear to only be hookable to :update, :save, :create and :destroy. I have a method called "extend_model" that does the job of adding an association after an instance is created which, more or less, gives me a polymorphic relationship. It does exactly what I want it to and works perfectly for the app I'm working on. The problem is, I have to call "extend_model" after a .get or a .first, which isn't painful or anything, but I would prefer if there was a way to do this automatically whenever an instance of this particular model was created. Does anyone have any idea what the best way to accomplish this is? I'm looking through the code in dm-core but being relatively new to it, to Ruby and to Merb I'm having a tough time even figuring out precisely where to look. I want "extend_model" (an instance method) called to create an additional relationship AFTER the instance data is loaded. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
