walmartlabs / thorax

Strengthening your Backbone
http://thoraxjs.org/
Other
1.32k stars 129 forks source link

this.model is null in collection view's initialize method #409

Open liorcode opened 9 years ago

liorcode commented 9 years ago

This commit: https://github.com/walmartlabs/thorax/commit/4dc07ff82f2bd9ad1561579da14d02eecc43e785 introduced a new bug: this.model is null in a collection view's initialize method.

I believe this is because options[type] is nullified: it works fine for views, as their constructor calls obj.ctor which calls setModel, but collection view doesn't have a constructor - so it doesn't call setModel (at least not before initialize), and therefore this.model is null (this._model is defined of course..)