When combining ActiveRecord's ability to use Abstract classes and single table inheritance in some cases (When the base class that inherites ActiveRecord::Base is abstract) find queries might fail.
When the first non-abstract class in the inheritance tree is used to do a query, ActiveRecord will fail to load other classes that are inheriting it. ActiveRecord wrongfully presumes that this class does not Directly descend from ActiveRecord (using the descends_from_active_record? method).
This method should return true if a class is the first non-abstract class to inherit from ActiveRecord.
For this I changed the setup of the current tests, (Company no inherits from AbstractCompany). If my patch would be unnecessary, it should have had no influences on the tests that use the Company object (and the objects that inherit from it).
However, after the change I had 9 failures and 1 error. After applying the patch everything went back to 0 failures and 0 errors.
I also added 1 more test, to accentuate my point.
One changes that might be discussed is the name of the descends_from_active_record? function to something more suitable.