> 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.
That's exactly what I'm suggesting. Here's a break down, including a
new name "include" (taken from ActiveRecord) instead of "eager_join":
eager_graph(other_model).map {|hash| ...}
eager_graph(other_model).all {|hash| ...}
eager_graph(other_model).each {|hash| ...}
eager_graph(other_model).first #=> Hash
include(other_model).map {|model| ...}
include(other_model).all {|model| ...}
include(other_model).each {|model| ...}
include(other_model).first #=> Model
In all cases, map, all, and each should yield the same argument type.
eager_graph can consistently yield hashes, and include can
consistently yield Model objects.
> 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.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---