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, line 33 def columns! if use_eager_all? clone(:all_called=>true).columns! else super end 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, line 64 def single_record! if use_eager_all? obj = clone(:all_called=>true).all.first if opts[:eager_graph] obj = clone(:all_called=>true).where(obj.qualified_pk_hash).unlimited.all.first end obj else super end 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, line 82 def use_eager_all? (opts[:eager] || opts[:eager_graph]) && !opts[:all_called] end