Module: Sequel::Plugins::SingleTableInheritance::InstanceMethods

Defined in:
lib/sequel/lib/sequel/plugins/single_table_inheritance.rb

Instance Method Summary collapse

Instance Method Details

#before_createObject

Set the sti_key column to the name of the model.


56
57
58
59
# File 'lib/sequel/lib/sequel/plugins/single_table_inheritance.rb', line 56

def before_create
  return false if super == false
  send("#{model.sti_key}=", model.name.to_s) unless send(model.sti_key)
end