backbone.js: sobrescrevendo paraJSON

Eu estou tentando implementar algumas coleções aninhadas em um Backbone.Model

Para fazer isso, tenho que substituir as funções do adaptador que analisam a resposta do servidor e agrupar a matriz em uma coleção e a função que serializa o objeto inteiro sem nenhum método auxiliar. Estou tendo problemas com o segundo.

var Model = Backbone.Model.extend({

    urlRoot: "/model",

    idAttribute: "_id",

    // this wraps the arrays in the server response into a backbone  collection
    parse: function(resp, xhr) {
        $.each(resp, function(key, value) {
            if (_.isArray(value)) {
                resp[key] = new Backbone.Collection(value);
            } 
        });
        return resp;
    },

    // serializes the data without any helper methods
    toJSON: function() {
        // clone all attributes
        var attributes = _.clone(this.attributes);

        // go through each attribute
        $.each(attributes, function(key, value) {
            // check if we have some nested object with a toJSON method
            if (_.has(value, 'toJSON')) {
                // execute toJSON and overwrite the value in attributes
                attributes[key] = value.toJSON();
            } 
        });

        return attributes;
    }

});

O problema agora está na segunda parte do JSON. Por algum motivo

_.has(value, 'toJSON') !== true

não retorna verdadeiro

Alguém poderia me dizer o que está errado?

questionAnswers(1)

yourAnswerToTheQuestion