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)


413
414
415
416
# File 'lib/sequel/plugins/hybrid_table_inheritance.rb', line 413

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)


419
420
421
422
# File 'lib/sequel/plugins/hybrid_table_inheritance.rb', line 419

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

#single_recordObject



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

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)


425
426
427
428
# File 'lib/sequel/plugins/hybrid_table_inheritance.rb', line 425

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



408
409
410
# File 'lib/sequel/plugins/hybrid_table_inheritance.rb', line 408

def with_sql_first(sql)
  post_load_record(super)
end