1

I get the following error when i try to call destroy function to my Backbone Model:

Uncaught TypeError: Cannot call method 'apply' of undefined backbone-firebase.js:126
Backbone.Firebase.sync backbone-firebase.js:126
Backbone.sync backbone-firebase.js:154
h.extend.sync backbone-min.js:1
h.extend.destroy backbone-min.js:1
Backbone.View.extend.remove sample.html:79
p.event.dispatch jquery.min.js:2
g.handle.h

Code: http://dl.dropboxusercontent.com/u/14749491/sample.html

kostas trichas
  • 2,923
  • 7
  • 28
  • 37

2 Answers2

2

Since you're using the "implicit" sync method, don't use destroy to remove the model, use the remove method on the collection instead.

If you'd like to use destroy, I recommend using the "explicit" sync method,,using Backbone.Collection.extend with a firebase property. More information on these two methods here: https://github.com/firebase/backfire

Anant
  • 7,408
  • 1
  • 30
  • 30
0

I don't know anything about BackFire. But it appears to be a conflict between FireBase and BackBone-FireBase. Since the code you are loading from the FireBase cdn is minified method names (like delete in this case) have been changed. Try using the unminified version of FireBase and see if it works correctly.

Morgan ARR Allen
  • 10,556
  • 3
  • 35
  • 33