0
votes

I did implement some code with ember-data talking to a sinatra json-app. Method findAll works as expected and load of records. Also I did implement the updateRecord-method in the DS.Store.create, but don't really know how to update and commit. Please, see the code here (for sake of brevity, I didn't include the jquery functions): http://pastie.org/3197008

I tried the following:

a = Todos.records.objectAt(0).set("text", "should be so")
a.store.commit()

But I get the following error: TypeError: Object (subclass of DS.State) has no method 'enter'

How should I update records? Or did I forget to implement something for the update?

Thanks in advance!

2

2 Answers

4
votes

I had the same problem. I think this is a bug in ember-data. The problem is that the code was not properly initializing certain substates, and those substates were not state instances but rather state classes.

I fixed the problem by defining a function that generates a new state instance (with properly created substates) each time it is called. You can find my changes here.

I also requested that the ember-data folks pull my fix, so hopefully this issue will disappear soon. You can view the pull request for discussion.

2
votes

i had the same problem this morning. Use the emberjs git version