私は解決しなければならない状況があります。確かに、人々はここに私が持っているモデルだ...そこのCoffeeScriptでバックボーンを破損するエラーCoffeescriptで生成されたリレーショナルモデル
をバックボーンRelationalを使用している:
class MyCompany.Models.Establishment extends Backbone.RelationalModel
defaults:
name: null
class MyCompany.Collections.EstablishmentsCollection extends Backbone.Collection
model: MyCompany.Models.Establishment
url: '/establishments'
私もちょうどRelationalModel延長、まだ関係が追加されていません。今、コンソールを介して、私はそれが成功し、サーバー上のモデルを破壊モデルのインスタンスに破棄発行するとき、それは微量で失敗したときに、完全な:それは、バックボーン・リレーショナルのライン235で死んだ
Uncaught TypeError: Object #<Establishment> has no method 'getCollection'
_.extend.unregister
Backbone.Events.trigger
Backbone.RelationalModel.Backbone.Model.extend.trigger
_.extend.destroy.options.success
jQuery.extend._Deferred.deferred.resolveWith
done
jQuery.ajaxTransport.send.callback
。 js 0.4.0は「this」がモデルであるため、それは想定されていたものではなく、モデルには「getCollection」というメソッドがありません。
私が間違っていることは何ですか、またはバグを報告する必要がありますか?参考までに、Javascriptのコーヒーが生成されます:
(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
MyCompany.Models.Establishment = (function() {
__extends(Establishment, Backbone.RelationalModel);
function Establishment() {
Establishment.__super__.constructor.apply(this, arguments);
}
Establishment.prototype.defaults = {
name: null
};
return Establishment;
})();
MyCompany.Collections.EstablishmentsCollection = (function() {
__extends(EstablishmentsCollection, Backbone.Collection);
function EstablishmentsCollection() {
EstablishmentsCollection.__super__.constructor.apply(this, arguments);
}
EstablishmentsCollection.prototype.model = MyCompany.Models.Establishment;
EstablishmentsCollection.prototype.url = '/establishments';
return EstablishmentsCollection;
})();
}).call(this);
コンソールからモデルを破壊するために使用しているコマンドは何ですか? –
ちょうどmodel.destroy() – Tony