AR::Base#type_condition uses Inflector.demodulize on class names, whereas AR::Associations::JoinDependency::JoinAssociation#association_join doesn't do this at all, causing issues when combining STI and modulized AR classes. This is true when using the :include option for example. All unit tests pass. Due to the edge-case nature of the issue (and the evidence that it clearly is an inconsistency) no additional unit tests have been added. My own implementation/specific unit test confirms that it works though.
before applying the patch (incorrect):
... LEFT OUTER JOIN folder_entries ON folder_entries.owner_id = pages.id AND folder_entries.owner_type = 'Page'AND folder_entries."type" = 'Folder::Favorite' ...
after applying the patch (correct):
... LEFT OUTER JOIN folder_entries ON folder_entries.owner_id = pages.id AND folder_entries.owner_type = 'Page'AND folder_entries."type" = 'Favorite' ...