| Module | Sequel::Plugins::EagerEach::DatasetMethods |
| In: |
lib/sequel/plugins/eager_each.rb
|
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.
# File lib/sequel/plugins/eager_each.rb, line 64
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