module Sequel::Plugins::ClassTableInheritance::InstanceMethods

  1. lib/sequel/plugins/class_table_inheritance.rb

Methods

Public Instance

  1. before_create
  2. delete

Public Instance methods

before_create ()

Set the cti_key column to the name of the model.

[show source]
# File lib/sequel/plugins/class_table_inheritance.rb, line 191
def before_create
  send("#{model.cti_key}=", model.name.to_s) if model.cti_key
  super
end
delete ()

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

[show source]
# File lib/sequel/plugins/class_table_inheritance.rb, line 198
def delete
  raise Sequel::Error, "can't delete frozen object" if frozen?
  m = model
  m.cti_tables.reverse.each do |table|
    m.db.from(table).filter(m.primary_key=>pk).delete
  end
  self
end