Skip to content

Commit

Permalink
Calling didCreateModel with a hash should update the data property (a…
Browse files Browse the repository at this point in the history
…nd therefore also invalidate any DS.attrs).
  • Loading branch information
tomhuda committed Dec 31, 2011
1 parent 9cdeaa9 commit f548be3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/ember-data/lib/system/store.js
Expand Up @@ -474,7 +474,7 @@ DS.Store = SC.Object.extend({
clientId = get(model, 'clientId');

data[clientId] = hash;
model.set('data', hash);
set(model, 'data', hash);

idToClientIdMap[id] = clientId;
idList.push(id);
Expand All @@ -496,6 +496,7 @@ DS.Store = SC.Object.extend({

clientId = get(model, 'clientId');
data[clientId] = hash;
set(model, 'data', hash);

idToClientIdMap[id] = clientId;
idList.push(id);
Expand Down
5 changes: 4 additions & 1 deletion packages/ember-data/tests/adapter_test.js
Expand Up @@ -313,7 +313,7 @@ test("by default, commit calls deleteMany once per type", function() {
});

test("by default, createMany calls create once per record", function() {
expect(6);
expect(8);
var count = 1;

adapter.create = function(store, type, model) {
Expand All @@ -329,8 +329,11 @@ test("by default, createMany calls create once per record", function() {

var hash = get(model, 'data');
hash.id = count;
hash.updatedAt = "now";

store.didCreateModel(model, hash);
equal(get(model, 'updatedAt'), "now", "the model should receive the new information");

count++;
};

Expand Down

0 comments on commit f548be3

Please sign in to comment.