module ActiveRecord::Inheritance::ClassMethods
def subclass_from_attributes(attrs)
Detect the subclass from the inheritance column of attrs. If the inheritance column value
def subclass_from_attributes(attrs) attrs = attrs.to_h if attrs.respond_to?(:permitted?) if attrs.is_a?(Hash) subclass_name = attrs[inheritance_column] || attrs[inheritance_column.to_sym] if subclass_name.present? find_sti_class(subclass_name) end end end