On Mar 19, 9:53 pm, David Lee <[email protected]> wrote: > > Trying to build associations using joins and not graphs would be much > > more difficult. If you get a workable patch that you think adds > > value, please submit it. > > include can just use graph to fetch the records, but build up the > associations into each Model object before yielding. Basically, > include would do what eager_graph.all currently does, except it would > do it for all enumerable methods, including each, map, and first. > eager_graph on the other hand would not apply any transformations > before returning the rows; it would just yield what the underlying > graph yields.
It's not something I would add to Sequel itself, as don't think the benefits of adding it outweigh the costs. Specifically, I don't think we need to add a third way of eager loading that is almost identical to an existing way. Currently, if you want eager loading to work, you need to call Dataset#all, and that's how I think it should remain. With the recent changes, you could do what you want with a plugin (model associations and even basic model functionality are both plugins now). That's the route I recommend you take if you want to add this. The great thing about the new architecture is that you can add a plugin to all models via: Sequel::Model.plugin :eager_each And all models have access to it. You can override any class, instance, or dataset method you want and call super. Jeremy --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sequel-talk" 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/sequel-talk?hl=en -~----------~----~----~----~------~----~------~--~---
