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)


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

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)


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

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

#single_recordObject



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

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)


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

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



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

def with_sql_first(sql)
  post_load_record(super)
end