model.collection isn't always there. #47

sontek opened this Issue Nov 12, 2012 · 1 comment


None yet
2 participants

sontek commented Nov 12, 2012

This line:

var store = model.localStorage || model.collection.localStorage; ( )

assumes that model.collection will be there but if you have a model who is not part of a collection, then this wont be there and you'll get cannot read property localStorage of undefined.


jeromegn commented Jan 14, 2013

Can you write a test case where this happens?

To me this looks fine. If the model is not within a collection, then the second part of the conditional statement will not be evaluated.

@jeromegn jeromegn closed this Jan 14, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment