jashkenas / jashkenas/backbone

The attribute Id has been updated, does the attribute nameId also need to be updated?

Open
#4,239 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
28.1k
Forks
5.3k
PR merge metrics
No merged PRs in 30d

Description

https://github.com/jashkenas/backbone/blob/0b1c2e3fce3156fcb9819b8bbf8885456e4e1055/backbone.js#L519

```
var hacker = new Backbone.Model({
name: "name",
idAttribute: 'nameId',
});
if (this.idAttribute in attrs) this.id = this.get(this.idAttribute);
```
The attribute Id has been updated, does the attribute nameId also need to be updated?
I don't think it is necessary to update the attribute id, just the nameId

> I wonder if you can understand Chinese, but my English is poor

Contributor guide

Open the contributing guide

Research direction

Start by reading the referenced section of backbone.js around line 519 and trace how idAttribute and the model's id are assigned during model initialization. Compare that behavior with the issue's nameId example and existing model tests, if available; done means the expected relationship between the configured attribute and id is documented or covered by a test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.