On Mon, 10 Aug 2009 13:46:27 -0700 (PDT) Thanatos <[email protected]> wrote:
> > Seems odd that the above code snippet is not handled on creation of > the relationships, no? Explicitly defining the property is an option, > yes, but as you say "redundant". I suppose for now, I'll add an > initializer (Rails) to handle that loading. > The reason it isn't is due to assumptions DM makes (or rather, a lack of them). Until the models on both ends of the relationship are loaded, DM doesn't know what kind of a property the key it's linking to is unless the model is loaded, so it can't make the foreign key property in the child model. It could do for some models, and perhaps with the correct load order, all models, but that isn't guaranteed. So it makes none of them, and lazily instantiates instead. And unfortunately, ruby doesn't support notifications on class declaration, so DM can't just enter things into a queue and try later. Regards, Jon --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
