reload should fully reload attributes#15866
Merged
Merged
Conversation
`reload` is meant to put a record in the same state it would be if you were to do `Post.find(post.id)`. This means we should fully replace the attributes hash.
senny
added a commit
that referenced
this pull request
Jun 22, 2014
`reload` should fully reload attributes
senny
added a commit
that referenced
this pull request
Jun 22, 2014
Member
|
This introduces a slight backwards incompatibility. You were able to access attributes from a custom It would be nice to issue a deprecation in these cases but I don't think we can easily detect wether someone is accessing these attributes. /cc @rafaelfranca |
Member
|
hmm, not sure about this change. I'd expect the select attributes to be there after the reload. |
Member
|
but you would also expect, that they were reloaded, no? |
Member
|
Ah, yes. If they are not being reloaded so it make sense to remove this behavior. |
Member
|
@rafaelfranca exactly. Removing them is not perfect but it's better than keeping them around without updating them. This could lead to bad bugs. |
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.
reloadis meant to put a record in the same state it would be if youwere to do
Post.find(post.id). This means we should fully replace theattributes hash.