Path: | lib/sequel/extensions/graph_each.rb |
Last Update: | Sat Jun 02 02:04:22 +0000 2018 |
frozen-string-literal: true
The graph_each extension adds Dataset#graph_each and makes Dataset#each call graph_each if the dataset has been graphed. Dataset#graph_each splits result hashes into subhashes per table:
DB[:a].graph(:b, id: :b_id).all # => {:a=>{:id=>1, :b_id=>2}, :b=>{:id=>2}}
You can load this extension into specific datasets:
ds = DB[:table] ds = ds.extension(:graph_each)
Or you can load it into all of a database‘s datasets, which is probably the desired behavior if you are using this extension:
DB.extension(:graph_each)
Related module: Sequel::GraphEach