Method: Sequel::Plugins::SingleTableInheritance::ClassMethods#sti_load

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

#sti_load(r) ⇒ Object

Return an instance of the class specified by sti_key, used by the row_proc.



54
55
56
57
58
59
60
61
62
# File 'lib/sequel/plugins/single_table_inheritance.rb', line 54

def sti_load(r)
  v = r[sti_key]
  model = if (v && v != '')
    constantize(v) rescue self
  else
    self
  end
  model.load(r)
end