Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.191.1/containers/ruby/.devcontainer/base.Dockerfile

# [Choice] Ruby version: 3, 3.0, 2, 2.7, 2.6
ARG VARIANT="3"
ARG VARIANT="4"
FROM mcr.microsoft.com/devcontainers/ruby:${VARIANT}

# Update Yarn keys
Expand Down Expand Up @@ -32,4 +32,3 @@ COPY Gemfile VERSION activerecord-sqlserver-adapter.gemspec /tmp/activerecord-sq
RUN cd /tmp/activerecord-sqlserver-adapter \
&& RAILS_BRANCH=main bundle install \
&& rm -rf /tmp/activerecord-sqlserver-adapter
RUN chown -R vscode:vscode /usr/local/rvm
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#### Added

- [#1385](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1385) Added support for Nulls first and last.
- [#1422](https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/pull/1422) Added ractors support.

#### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ def load_records_for_keys(keys, &block)

return [] if keys.empty?

if association_key_name.is_a?(Array)
if destination_key_name.is_a?(Array)
query_constraints = Hash.new { |hsh, key| hsh[key] = Set.new }

keys.each_with_object(query_constraints) do |values_set, constraints|
association_key_name.zip(values_set).each do |key_name, value|
constraints[key_name] << value
destination_key_name.each_with_index do |key_name, index|
constraints[key_name] << values_set[index]
end
end

scope.where(query_constraints).load(&block)
else
keys.each_slice(in_clause_length).flat_map do |slice|
scope.where(association_key_name => slice).load(&block).records
scope.where(destination_key_name => slice).load(&block).records
end
end
end
Expand Down
Loading