Module: Sequel::Plugins::HybridTableInheritance::DatasetMethods

Defined in:
lib/sequel/plugins/hybrid_table_inheritance.rb

Instance Method Summary collapse

Instance Method Details

#eagerObject

Set dataset to use eager loading

Raises:

  • (Error)


404
405
406
407
# File 'lib/sequel/plugins/hybrid_table_inheritance.rb', line 404

def eager
  raise Error, "eager loading disabled" if model.cti_subclass_load == :lazy_only
  clone(:eager_load => true)
end

#lazyObject

Set dataset to use lazy loading

Raises:

  • (Error)


410
411
412
413
# File 'lib/sequel/plugins/hybrid_table_inheritance.rb', line 410

def lazy
  raise Error, "lazy loading disabled" if model.cti_subclass_load == :eager_only
  clone(:eager_load => false)
end

#single_recordObject



395
396
397
# File 'lib/sequel/plugins/hybrid_table_inheritance.rb', line 395

def single_record
  post_load_record(super)
end

#uses_eager_load?Boolean

Return true if eager loading will be used, false/nil for lazy loading

Returns:

  • (Boolean)


416
417
418
419
# File 'lib/sequel/plugins/hybrid_table_inheritance.rb', line 416

def uses_eager_load?
  return opts[:eager_load] unless opts[:eager_load].nil?
  [:eager, :eager_only].include?(model.cti_subclass_load)
end

#with_sql_first(sql) ⇒ Object



399
400
401
# File 'lib/sequel/plugins/hybrid_table_inheritance.rb', line 399

def with_sql_first(sql)
  post_load_record(super)
end