#4038·backbone

Model.set does not call Model.parse, unlike Collection.set

Author: JSteunouCreated May 31, 2016Updated Jul 27, 2023
Labelsbreakquality

I stumble on a case where I did not understand why my model.set called with {parse: true} did not call the parse method. I was very surprise to discover that parse must be called manually before a model.set whereas an option {parse: true} is enough for Collection.

Why Collection automatically parse inside the set when option parse is true, whereas Model does the parse outside the set ? Model fetch/save/constructor do call the parse method with options.parse on true, set is really the only method with a weird behaviour. Is there a good reason?