HelloWorld initialize method causes infinite loop
chreke opened this issue · comments
Christoffer Ekeroth commented
Uncommenting these lines in models/hello_world.js
causes the application to go into an infinite loop:
//,initialize: function(attributes, options) {
//Model.apply(this, arguments);
//console.debug('HelloWorld#initialize');
//}
I haven't gone really deep into this but I guess the underlying cause is that calling Model.apply
calls the Model's constructor, which in turn calls initialize
with the new HelloWorld
as its context?
Replacing Model.apply
with Model.prototype.initialize.apply
solves the problem, but I'm not sure if this is a 100% reflection of what's happening in the Coffeescript example? (I'm a bit of a Coffeescript noob, sorry about that)
Paul Miller commented
That’s right. Fixed.
Christoffer Ekeroth commented
Wow, that was quick! Thanks! :)