emberjs/data — pull request #48 by kyptin (2012-01-17 20:20:19+00:00)
Title: Fixed error when committing a created record

When creating a record and calling commit on the store, I get the following error:

Uncaught TypeError: Object (subclass of DS.State) has no method 'enter'

Here is some code that exhibits this error:

window.App = Ember.Application.create();

App.store = DS.Store.create({
adapter: DS.Adapter.create({
createRecord: function() {
console.log('created record');
}
}),
});

App.Person = DS.Model.extend({
name: DS.attr('string'),
});

App.store.createRecord(App.Person, {name: 'Jeff T.'});
App.store.commit();

The problem was that we were attempting to enter a state class, rather than a state instance. This was caused by calling `DS.State.extend()` within another `DS.State.extend()` call.