module Sequel::Plugins::ClassTableInheritance::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/class_table_inheritance.rb
387 def before_validation
388   if new? && (set = self[model.sti_key])
389     exp = model.sti_key_chooser.call(self)
390     if set != exp
391       set_table = model.sti_class_from_key(set).cti_table_name
392       exp_table = model.sti_class_from_key(exp).cti_table_name
393       set_column_value("#{model.sti_key}=", exp) if set_table != exp_table
394     end
395   end
396   super
397 end
delete() click to toggle source

Delete the row from all backing tables, starting from the most recent table and going through all superclasses.

    # File lib/sequel/plugins/class_table_inheritance.rb
378 def delete
379   raise Sequel::Error, "can't delete frozen object" if frozen?
380   model.cti_models.reverse_each do |m|
381     cti_this(m).delete
382   end
383   self
384 end