-
Notifications
You must be signed in to change notification settings - Fork 182
Fix resource serialization involving last_result_set #351
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
Fix resource serialization involving last_result_set #351
Conversation
@gaorlov Hi again ) as an option we can add |
1ee8c05
to
c2deea5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like relationships.last_result_set
was being handled by the dynamic attribute helper; I don't think we need to add an accessor.
This looks fine to me, but I'd like to understand what that code did int he first place. @senid231 can you explain your thinking here?
Indeed, and that is a problem - this way such This PR just removes all rudimental writes to |
@senid231 have you had a chance to look over this? I'm fine with adding the |
@gaorlov @stokarenko indeed I've introduce it by mistake while add relationship caching thanks for fixing it, @stokarenko |
|
Thank you a lot! ) |
Sometimes
JsonApiClient::Resource
instance evaluatesself.relationships.last_result_set = last_result_set
orself.relationships.last_result_set = nil
. This behavior was introduced by performance optimization commit.But we never read the
last_result_set
property onJsonApiClient::Relationships::Relations
objects, only the writes everywhere. That means that these writes are kind of rudiments.Even worse, there is no
attr_accessor :last_result_set
defined forJsonApiClient::Relationships::Relations
class, this way an attempt to writelast_result_set
property triggersHelpers::DynamicAttributes
routine -last_result_set
value become to be a part ofattributes
hash, and will be serialized then.Lets remove rudimental writes to
relationships.last_result_set
. Without this fix the newly added test fails like this: