Module: Sequel::Plugins::SingleTableInheritance::InstanceMethods
- Defined in:
- lib/sequel/plugins/single_table_inheritance.rb
Instance Method Summary collapse
-
#before_validation ⇒ Object
Set the sti_key column based on the sti_key_map.
Instance Method Details
#before_validation ⇒ Object
Set the sti_key column based on the sti_key_map.
247 248 249 250 251 252 |
# File 'lib/sequel/plugins/single_table_inheritance.rb', line 247 def before_validation if new? && model.sti_key && !self[model.sti_key] set_column_value("#{model.sti_key}=", model.sti_key_chooser.call(self)) end super end |