Module | Sequel::Plugins::ClassTableInheritance::InstanceMethods |
In: |
lib/sequel/plugins/class_table_inheritance.rb
|
Set the sti_key column based on the sti_key_map.
# File lib/sequel/plugins/class_table_inheritance.rb, line 359 359: def before_validation 360: if new? && (set = self[model.sti_key]) 361: exp = model.sti_key_chooser.call(self) 362: if set != exp 363: set_table = model.sti_class_from_key(set).cti_table_name 364: exp_table = model.sti_class_from_key(exp).cti_table_name 365: set_column_value("#{model.sti_key}=", exp) if set_table != exp_table 366: end 367: end 368: super 369: end
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, line 345 345: def delete 346: raise Sequel::Error, "can't delete frozen object" if frozen? 347: model.cti_models.reverse_each do |m| 348: cti_this(m).delete 349: end 350: self 351: end