Skip to content

Set model.id if attributes contain a parsed version of idAttribute - #1760

Merged
ricardograca merged 2 commits into
masterfrom
rg-parse-idAttribute
Feb 11, 2018
Merged

Set model.id if attributes contain a parsed version of idAttribute#1760
ricardograca merged 2 commits into
masterfrom
rg-parse-idAttribute

Conversation

@ricardograca

Copy link
Copy Markdown
Member

Introduction

This ensures that Model#id is set correctly even if the model has a custom parse method that mutates attribute keys.

Motivation

This is a followup to the previous PR that needed some changes but its author didn't respond.

Proposed solution

This is almost identical to the previous PR, except that it doesn't store the parsed id attribute when extending the model but instead parses it when it's actually needed. This ensures that the parsed idAttribute is always correct.

This PR also doesn't include the exception when not all relations can be retrieved since it wasn't clear what the purpose of that code was.

Closes #1082.

- This ensures that Model#id is set correctly even if the model has a
custom parse method that mutates attribute keys.
@ricardograca
ricardograca merged commit b6d1068 into master Feb 11, 2018
@ricardograca
ricardograca deleted the rg-parse-idAttribute branch February 11, 2018 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant