module Sequel::Plugins::SingleTableInheritance::InstanceMethods

Public Instance Methods

before_validation() click to toggle source

Set the sti_key column based on the sti_key_map.

Calls superclass method
# File lib/sequel/plugins/single_table_inheritance.rb, line 246
def before_validation
  if new? && model.sti_key && !self[model.sti_key]
    set_column_value("#{model.sti_key}=", model.sti_key_chooser.call(self))
  end
  super
end

Private Instance Methods

_filter_tactical_eager_load_objects(opts) click to toggle source

Limit tactical eager loading objects to objects that support the same association.

Calls superclass method
# File lib/sequel/plugins/single_table_inheritance.rb, line 256
def _filter_tactical_eager_load_objects(opts)
  objects = defined?(super) ? super : retrieved_with.dup
  name = opts[:name]
  objects.select!{|x| x.model.association_reflections.include?(name)}
  objects
end
use_prepared_statements_for?(type) click to toggle source

Don't allow use of prepared statements.

# File lib/sequel/plugins/single_table_inheritance.rb, line 264
def use_prepared_statements_for?(type)
  false
end