This method is deprecated or moved on the latest stable version.
The last existing version (v4.0.2) is shown here.
subclass_from_attrs(attrs)
private
Detect the subclass from the inheritance column of attrs. If the
inheritance column value is not self or a valid subclass, raises ActiveRecord::SubclassNotFound
If this is a StrongParameters hash,
and access to inheritance_column is not permitted, this will ignore the
inheritance column and return nil
# File activerecord/lib/active_record/inheritance.rb, line 171
def subclass_from_attrs(attrs)
subclass_name = attrs.with_indifferent_access[inheritance_column]
if subclass_name.present? && subclass_name != self.name
subclass = subclass_name.safe_constantize
unless descendants.include?(subclass)
raise ActiveRecord::SubclassNotFound.new("Invalid single-table inheritance type: #{subclass_name} is not a subclass of #{name}")
end
subclass
end
end