Module Searchlogic::ActiveRecord::Consistency
In: lib/searchlogic/active_record/consistency.rb

Active Record is pretty inconsistent with how their SQL is constructed. This method attempts to close the gap between the various inconsistencies.

Methods

Public Class methods

Public Instance methods

This method ensures that the order of the conditions in the joins are the same. The strings of the joins MUST be exactly the same for AR to remove the duplicates. AR is not consistent in this approach, resulting in duplicate joins errors when combining scopes.

In AR multiple joins are sometimes in a single join query, and other times they are not. The merge_joins method in AR should account for this, but it doesn‘t. This fixes that problem. This way there is one join per string, which allows the merge_joins method to delete duplicates.

[Validate]