Skip to content
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 eager loading of relations when using parse/format #1838

Merged
merged 3 commits into from May 7, 2018
Merged

Conversation

@ricardograca
Copy link
Member

@ricardograca ricardograca commented May 7, 2018

Introduction

This fixes eager loading of related models when the parent model had a custom id attribute and a parse/format method that mutated it.

Motivation

For more info check the linked issue.

Proposed solution

This just runs the parentIdAttribute through that model's parse method in order to get the parsed key that is needed for pairing the eager fetched models with their parents.

Fixes #1502.

Alternatives considered

A better approach would probably be to delay the parsing of model attributes until the very last moment before models are delivered to the user, but that would require a more extensive refactoring of the whole parse/format functionality that is better suited for a separate task later on.

ricardograca added 3 commits May 7, 2018
- Eager loading related models is failing when the parent model has a
custom id attribute and a parse/format method that mutates it.
- The failure was when Eager loading related models is failing when the
parent model had a custom id attribute and a parse/format method that
mutated it.
@ricardograca ricardograca added this to To Do in Version 0.14.0 via automation May 7, 2018
@ricardograca ricardograca merged commit 13ee6f5 into master May 7, 2018
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
Version 0.14.0 automation moved this from To Do to Done May 7, 2018
@ricardograca ricardograca deleted the rg-eager-load branch May 7, 2018
@skout90
Copy link

@skout90 skout90 commented Jun 23, 2018

@ricardograca thanks!!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked issues

Successfully merging this pull request may close these issues.

2 participants