Fix Error for Array-Based Composite Keys in nested_attribute #613
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem Description
I recently updated my project to Rails 6 and faced a testing error when passing a composite key as an array to nested_attribute.
I have added a test case for this error. Please refer to this test case if necessary.
PR Description
Since this commit, record detection in nested_attributes.rb has been conducted using the
detect
method instead ofcpk_detect_record
.I could not find any mention of this change, and considering that
cpk_detect_record
still exists innested_attributes.rb
but is not used, I created this PR.This PR reverts to the approach used prior to the introduction of this PR.
If we are intended to use
CompositePrimaryKeys::CompositeKeys
for creating id as demonstrated in the test case (i.e., if the above change was intentional), I will close this PR.Also, a quick thanks to the maintainers for their ongoing work on the project 👍