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 351 351: def before_validation 352: if new? && (set = self[model.sti_key]) 353: exp = model.sti_key_chooser.call(self) 354: if set != exp 355: set_table = model.sti_class_from_key(set).cti_table_name 356: exp_table = model.sti_class_from_key(exp).cti_table_name 357: set_column_value("#{model.sti_key}=", exp) if set_table != exp_table 358: end 359: end 360: super 361: 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 337 337: def delete 338: raise Sequel::Error, "can't delete frozen object" if frozen? 339: model.cti_models.reverse_each do |m| 340: cti_this(m).delete 341: end 342: self 343: end