Many of my Backbone models often deal with nested models and collections, so far I\'m using a combination of defaults
, parse
and toJSON
ma
I don't see any problem with your approach.
IMHO the Model.parse()
method if for this: to be overwritten in case special parse behavior needs.
The only think I'd change would be things like this:
if (res.tags) res.tags = new ACME.Tags(res.tags);
For this:
if (res.tags) this.tags.reset(res.tags);
Due you already have an instance of ACME.Tags
collection I'd reuse it.
Also I don't really like the defaults
implementation, I'm used to do this initializations in the Model.initialize()
but I think is a matter of taste.