対応するモデルでidAttributeを設定しても、IDで単一のモデルを取得するのに問題があります。
コレクションは次のようになります。
[
{
"_account": "51dc04dbe4e643043d000001",
"name": "test.png",
"type": "image/png",
"_id": "51ff833f0342ee0000000001",
"added": "2013-08-05T10:49:35.737Z"
}
]
// Inside the Model I defined idAttribute
FileModel = Backbone.Model.extend({
idAttribute : "_id",
urlRoot : "/api/file"
[...]
}
// The collection contain each of the Model items
// but if I try to get a single model item by id:
Collection.get("51ff833f0342ee0000000001") -> the result is undefined
理由がわかりません.Backbone.Collection get model by idからの解決策は、問題を解決するための鍵ではありませんでした。