Descendants vs Subclasses in Ruby
By Abhishek on January 21, 2022
descendants is available in Rails.
subsclasses is native ruby method and is available in ruby 3.1
# available in rails Parent.descendants => [ChildA, GrandChildA, ChildB] # available in ruby Parent.subclasses => [ChildA, ChildB]
descendants return all the child classes and
subclasses only returns child classes directly associated to parent class.