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

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

Instance Method Summary collapse

Instance Method Details

#before_validationObject

Set the sti_key column based on the sti_key_map.



219
220
221
222
223
224
# File 'lib/sequel/plugins/single_table_inheritance.rb', line 219

def before_validation
  if new? && !self[model.sti_key]
    send("#{model.sti_key}=", model.sti_key_chooser.call(self))
  end
  super
end