You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I debugged local_storage.js and found out that the method _keyForRecordType always returns "sproutcore.local.storage.undefined", meaning that the property recordType.localStorageKey placed on a model SC.Record (as in Todos.Todo model) is always undefined. Therefore, that datasource does not work when you have more than one model.
I'm using SC v1.9.2.
Cheers
The text was updated successfully, but these errors were encountered:
The bug in this code looks to be simply that we define the localStorateKey property as an instance property, but try to use it as a class property. Given that we're syncing data into local storage on a per-Model basis, the class is probably the correct place for this. So in todos.js (the app's lovely monolithic file) round about line 34, you'd change this:
// Define the Todo model.Todos.Todo=SC.Record.extend({title: SC.Record.attr(String),isDone: SC.Record.attr(Boolean,{defaultValue: false}),createdAt: SC.Record.attr(SC.DateTime),// The string used by the localStorage adapter to uniquely identify// this model type.localStorageKey: 'todo'});
to this:
// Define the Todo model.Todos.Todo=SC.Record.extend({title: SC.Record.attr(String),isDone: SC.Record.attr(Boolean,{defaultValue: false}),createdAt: SC.Record.attr(SC.DateTime),});Todos.Todo.mixin({// The string used by the localStorage adapter to uniquely identify// this model type.localStorageKey: 'todo'});
I debugged local_storage.js and found out that the method _keyForRecordType always returns "sproutcore.local.storage.undefined", meaning that the property recordType.localStorageKey placed on a model SC.Record (as in Todos.Todo model) is always undefined. Therefore, that datasource does not work when you have more than one model.
I'm using SC v1.9.2.
Cheers
The text was updated successfully, but these errors were encountered: