class Ransack::Adapters::ActiveRecord::Context

def join_sources


JoinDependency to track table aliases.
This extracts what we need to access the joins using our existing
that ActiveRecord's build_joins sets up its own JoinDependency.
This could otherwise be done as `@object.arel.join_sources`, except

All dependent Arel::Join nodes used in the search query.
def join_sources
  base, joins = begin
    alias_tracker = ::ActiveRecord::Associations::AliasTracker.create(self.klass.connection, @object.table.name, [])
    constraints   = if ::Gem::Version.new(::ActiveRecord::VERSION::STRING) >= ::Gem::Version.new(Constants::RAILS_6_1)
      @join_dependency.join_constraints(@object.joins_values, alias_tracker, @object.references_values)
    elsif ::Gem::Version.new(::ActiveRecord::VERSION::STRING) >= ::Gem::Version.new(Constants::RAILS_6_0)
      @join_dependency.join_constraints(@object.joins_values, alias_tracker)
    else
      @join_dependency.join_constraints(@object.joins_values, @join_type, alias_tracker)
    end
    [
      Arel::SelectManager.new(@object.table),
      constraints
    ]
  end
  joins.each do |aliased_join|
    base.from(aliased_join)
  end
  base.join_sources
end