-
Notifications
You must be signed in to change notification settings - Fork 41
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
Do not try to hydrate undeclared attributes from storage on batch_read #139
Do not try to hydrate undeclared attributes from storage on batch_read #139
Conversation
Hi! Thank you for submitting this fix. This looks good. |
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.
Thanks for your contribution!
@mullermp done |
Sorry, this also needs a changelog entry, you can add something like
Then it's good to go |
@mullermp wasn't sure how the release process goes, will do that asap. Should this be under the Unreleased Changes section on the |
New version of the gem is out: https://rubygems.org/gems/aws-record/versions/2.13.1 |
Issue #, if available:
N/A
Description of changes:
Hello all and thank you for the great gem. There is an asymmetry around hydrating records on read operations between canonical queries and batch reads. The asymmetry is located around undeclared attributes on the model class.
Example of model with undeclared attribute
On the above model when using canonical queries like
Model.find(ID: '123')
orModel.query(...)
any undeclared attributes are omitted when building the final model instance. So in the above case we will end up with a Model instance that does not have age hydrated onto it.But if we use a Batch Read then the
build_item
method will try to call#=
on Nil.This PR just skips any storage attributes that are not declared on the model class when batch reading
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.