Skip to content

Conversation

@JayeshPattern
Copy link
Contributor

ActiveRecord::Associations::Preloader.new(records: payload, associations: associations).call
From rails 7, it expects payload to be an array.

Copilot AI review requested due to automatic review settings March 17, 2025 04:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request fixes the handling of payloads for ActiveRecord::Associations by ensuring that the payload is always an array, which is required in Rails 7. The changes include:

  • Using a ternary operator to conditionally return a single record in execute_query.
  • Wrapping @results in an array for load_associations and preload_associations.
  • Unifying the handling of single versus multiple results across association methods.

@JayeshPattern JayeshPattern merged commit 192f58a into master Mar 17, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants