lib/inventory_refresh/inventory_collection.rb
def db_collection_for_comparison_for(references)
      query = full_collection_for_comparison.where(targeted_selection_for(references))
      if pure_sql_record_fetching?
        return get_connection.query(query.select(*select_keys).to_sql)
      end

      query
    end
def db_collection_for_comparison_for(references)
      query = full_collection_for_comparison.where(targeted_selection_for(references))
      if pure_sql_record_fetching?
        return get_connection.query(query.select(*select_keys).to_sql)
      end

      query
    end
Builds an ActiveRecord::Relation that can fetch all the references from the DB

 @param references [Hash{String => InventoryRefresh::InventoryCollection::Reference}] passed references
 @return [ActiveRecord::Relation] relation that can fetch all the references from the DB