ActiveRecord#strict_loading! should return boolean instead of current mode set.#41839
Merged
eileencodes merged 1 commit intorails:mainfrom Apr 15, 2021
Merged
Conversation
Member
|
cc/ @dinahshi can you review this? |
Contributor
Author
|
Ping cc/ @eileencodes @dinahshi |
Member
|
How about adding assertion on |
The return type was changed in the PR rails#41704 after addition of mode option. The current documentation is misleading since documentation puropose strict_loading! would return boolean whereas it returns the current mode set. I can across this issue while debugging issue: rails#41827 and thought this should be brought to the attention. PR fixes the issue and would always return boolean based on strict_loading is enabled or disabled. ``` user.strict_loading! # => true user.strict_loading!(false) # => false user.strict_loading!(mode: :n_plus_one_only) # => true ```
503710e to
2629f48
Compare
Contributor
Author
|
@kamipo Added test cases. CI failure doesn't look relevant and at the moment the |
Member
|
I can say this failure against mysql2 adapter is not relevant to this pull request. Refer #41948 |
This file contains hidden or 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
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.
The return type was changed in the PR #41704 after addition of mode
option. The current documentation is misleading since
documentation propose strict_loading! would return boolean whereas
it returns the current mode set.
I came across this issue while debugging: #41827 and thought
this should be brought to the attention.
PR fixes the issue and would always return boolean based on
strict_loading is enabled or disabled.