jashkenas / backbone

Give your JS App some Backbone with Models, Views, Collections, and Events
http://backbonejs.org
MIT License
28.1k stars 5.39k forks source link

Add warning to documentation about setting the model id in the defaults #4279

Closed jgonggrijp closed 1 year ago

jgonggrijp commented 1 year ago

Please see #4205 for a rationale of this change. My thoughts that led to this PR are in the bottom comment.

I have asked myself whether this should be documented at all, given that it is a rather obscure corner case (user sets the model id to a fixed value in the defaults and also adds instances of the model to a collection). However, the fact that #4205 was reported proves that users may encounter the situation.

The edit can be previewed as web page over here: https://cdn.statically.io/gh/jgonggrijp/backbone/document-defaults-idAttribute/index.html#Model-defaults.

jgonggrijp commented 1 year ago

@paulfalgout Better now?