class method
self.class_of_active_record_descendant
Ruby on Rails 2.3.18
Since v2.2.3 Last seen in v3.1.12Signature
self.class_of_active_record_descendant(klass)
Returns the class descending directly from ActiveRecord::Base or an abstract class, if any, in the inheritance hierarchy.
Parameters
-
klassreq
Source
# File activerecord/lib/active_record/base.rb, line 2249
def class_of_active_record_descendant(klass)
if klass.superclass == Base || klass.superclass.abstract_class?
klass
elsif klass.superclass.nil?
raise ActiveRecordError, "#{name} doesn't belong in a hierarchy descending from ActiveRecord"
else
class_of_active_record_descendant(klass.superclass)
end
end
Defined in activerecord/lib/active_record/base.rb line 2249
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::Base