module Sequel::Plugins::EagerEach::DatasetMethods
Public Instance Methods
all(&block)
click to toggle source
columns!()
click to toggle source
Don't call all
when attempting to load the columns.
Calls superclass method
# File lib/sequel/plugins/eager_each.rb 33 def columns! 34 if use_eager_all? 35 clone(:all_called=>true).columns! 36 else 37 super 38 end 39 end
each(&block)
click to toggle source
single_record!()
click to toggle source
Handle eager loading when calling first and related methods. For eager_graph, this does an additional query after retrieving a single record, because otherwise the associated records won't get eager loaded correctly.
Calls superclass method
# File lib/sequel/plugins/eager_each.rb 64 def single_record! 65 if use_eager_all? 66 obj = clone(:all_called=>true).all.first 67 68 if opts[:eager_graph] 69 obj = clone(:all_called=>true).where(obj.qualified_pk_hash).unlimited.all.first 70 end 71 72 obj 73 else 74 super 75 end 76 end
Private Instance Methods
use_eager_all?()
click to toggle source
Wether to use all when each is called, true when eager loading unless the flag has already been set.
# File lib/sequel/plugins/eager_each.rb 82 def use_eager_all? 83 (opts[:eager] || opts[:eager_graph]) && !opts[:all_called] 84 end