I'm using coffeescript. My code is pretty simple:
class SomeCollection extends Backbone.Collection
constructor: (@options) ->
url: ->
"#{$SCRIPT_ROOT}/some/data/#{@options.someId}"
model: SomeModel
class SomeView extends Backbone.View
initialize: ->
myCollection = new SomeCollection()
myCollection.fetch
success: (coll, resp) ->
console.log coll
The JSON that's being returned from my collection's url is exactly:
[{"id": 1, "comments": "", "name": "images/exceptions/59.png"}]
However, before anything is printed to the console, I receive a backbone.js error on line 768: Cannot read property 1 of undefined. The undefined object is this._byId
within the collection's get
function. How can I solve this problem?