Reputation: 191
Before I get into the question, I should point out that I do not want to use the find operation to retrieve a record from the data store, I am attempting to access only the local storage without hitting the backend.
Okay, with that out of the way, I was looking at the ember docs which states the following: /** Update existing records in the store. Unlike push, update will merge the new data properties with the existing properties. This makes it safe to use with a subset of record attributes. This method expects normalized data.
update is useful if your app broadcasts partial updates to
records.
App.Person = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string')
});
store.get('person', 1).then(function(tom) {
tom.get('firstName'); // Tom
tom.get('lastName'); // Dale
var updateEvent = {id: 1, firstName: "TomHuda"};
store.update('person', updateEvent);
tom.get('firstName'); // TomHuda
tom.get('lastName'); // Dale
});
Now..my issue is when I try to do this:
store.get('person', 1).then(function(tom)
get is returning undefined even though when I use Ember Inspector, I can see the record inside the data store.
The happens for any objects I attempt to query in the store.
How do you use the store.get api?
Upvotes: 0
Views: 413