The coffeescript to js translation may not be happening correctly. Try changing to
transaction = @get('store').transaction()
I have found the implicit method invocation in coffeescript trips up in Ember occasionally.
Question
I'm attempting to create an ember transaction
to commit a single model to the backend api.
Coffeescript:
comic = App.Comic.createRecord(title: @get('comicTitle'))
transaction = comic.get('store').transaction
transaction.add(comic)
transaction.commit()
Which gives the javascript error:
Uncaught TypeError: Object function () {
return DS.Transaction.create({ store: this });
} has no method 'add'
I've googled various different ways to use ember transactions, but I'm not sure where I'm going wrong. I'm using the latest version of ember data.
Solution
The coffeescript to js translation may not be happening correctly. Try changing to
transaction = @get('store').transaction()
I have found the implicit method invocation in coffeescript trips up in Ember occasionally.