Method: Sequel::Plugins::EagerEach::DatasetMethods#single_record!
- Defined in:
- lib/sequel/plugins/eager_each.rb
#single_record! ⇒ Object
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.
64 65 66 67 68 69 70 71 72 73 74 75 76 |
# 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 |