instance method
subclass_from_attributes?
Ruby on Rails 4.1.16
Since v4.0.13 Last seen in v4.2.9 PrivateSignature
subclass_from_attributes?(attrs)
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
Parameters
-
attrsreq
Source
# File activerecord/lib/active_record/inheritance.rb, line 179
def subclass_from_attributes?(attrs)
columns_hash.include?(inheritance_column) && attrs.is_a?(Hash)
end
Defined in activerecord/lib/active_record/inheritance.rb line 179
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Inheritance::ClassMethods