On Mar 19, 4:59 pm, David Lee <[email protected]> wrote: > I was asking you to put documentation into #all and #each as well, not > only under eager_graph and graph. If you take a look at the docs for > #each and #all right now, you have no idea what kind of arguments will > be passed into the block.
If you use graph, one can assume you read the graph documentation. If you use eager_graph, one can assume you read the eager_graph documentation. If you are using your own row_proc, one assumes you know what you are doing. If you aren't doing one of those things, you can safely assume you are getting hashes out of regular datasets and model objects out of model datasets. > > information. each can actually return anything you want it to return, > > since it can call a user provided row_proc, so I think your point > > This behavior should be documented under #all and #each. I suppose. Since you feel strongly about it, I'll consider a documentation patch. > > about each not guaranteeing what types of objects are yielded doesn't > > make much sense. Since all just collects what is yielded by each, the > > same is true for all. > > Is this really the case? Isn't the whole problem that eager_graph.all > is not "just collecting what is yielded by each." all does collect what is yielded by each. eager_graph modifies what all collects before all yields or returns. > Now that I understand your reservations for changing the behavior of > eager_graph.each because it departs from the behavior of graph.each, I > suggest that eager_graph.all return the same thing as eager_graph.map. > Perhaps all could just be an alias to map. eager_graph.map returns an array of hashes with model object values. If all was an alias of map, eager_graph.all wouldn't return model objects with cached associations. > There should also be an eager_* method that does not behave like > graph, but behaves like eager, while using join instead of a multi- > query process to build the associations. Maybe eager_join? Or just > eager(:other_model, :use_joins => true)? 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. Not that it makes much of a difference, but have you read the code that we are talking about? If not, I would suggest it. 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 -~----------~----~----~----~------~----~------~--~---
