New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check that entire collection has been loaded before short circuiting #37747
Merged
kamipo
merged 1 commit into
rails:master
from
bradleyprice:check-association-loaded-across-collection-on-preload
Nov 19, 2019
Merged
Check that entire collection has been loaded before short circuiting #37747
kamipo
merged 1 commit into
rails:master
from
bradleyprice:check-association-loaded-across-collection-on-preload
Nov 19, 2019
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bradleyprice
force-pushed
the
check-association-loaded-across-collection-on-preload
branch
3 times, most recently
from
November 19, 2019 00:38
e708c64
to
67ee403
Compare
kamipo
reviewed
Nov 19, 2019
kamipo
reviewed
Nov 19, 2019
@kamipo I've made the requested changes. How does this get ported to rails 5.2? Should I create a separate PR for that? |
Can you squash your commits into one? I'll backport a bugfix to 6-0-stable (5-2-stable too) after this is getting merged, since 5-2-stable is before a final release. |
Currently, when checking that the collection has been loaded, only the first record is checked. In specific scenarios, if a record is fetched via an `after_initialize` hook, there is a chance that the first record has been loaded, but other records in the collection have not. In order to successfully short circuit the fetching of data, we need to verify that all of the records in the collection have been loaded. * Create test for edge case * Move `reset_callbacks` method to `cases/helper`, since it has been defined in multiple locations. Closes rails#37730
bradleyprice
force-pushed
the
check-association-loaded-across-collection-on-preload
branch
from
November 19, 2019 21:33
d8ea5d2
to
0a5b41c
Compare
Squashed. Thanks for the help! |
kamipo
added a commit
that referenced
this pull request
Nov 19, 2019
…across-collection-on-preload Check that entire collection has been loaded before short circuiting
kamipo
added a commit
that referenced
this pull request
Nov 19, 2019
…across-collection-on-preload Check that entire collection has been loaded before short circuiting
kamipo
added a commit
that referenced
this pull request
Nov 19, 2019
…across-collection-on-preload Check that entire collection has been loaded before short circuiting
JesseChavez
pushed a commit
to JesseChavez/rails
that referenced
this pull request
Dec 19, 2019
…aded-across-collection-on-preload Check that entire collection has been loaded before short circuiting
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Currently, when checking that the collection has been loaded, only the first
record is checked. In specific scenarios, if a record is fetched via an
after_initialize
hook, there is a chance that the first record has been loaded, but other records in the
collection have not.
In order to successfully short circuit the fetching of data, we need to verify that
all of the records in the collection have been loaded.
reset_callbacks
method tocases/helper
, since it has been defined in multiplelocations.
Closes #37730
Other Information