I am currently working with coffeescript and my code is quite straightforward:
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 response JSON from the collection's URL looks like this:
[{"id": 1, "comments": "", "name": "images/exceptions/59.png"}]
However, even before anything gets printed to the console, I encounter a backbone.js error at line 768: Cannot read property 1 of undefined. The undefined object in this case is this._byId
within the collection's get
function. How can I troubleshoot this issue?