我从我的控制器收到此错误:
Uncaught TypeError: Object invitation has no method '_create'
DS.Store.Ember.Object.extend.createRecord ember-data.js?body=1:1580
App.GroupController.Ember.ObjectController.extend.actions.createInvitation group_controller.js?body=1:11
Ember.ActionHandler.Ember.Mixin.create.send ember.js?body=1:18346
runRegisteredAction ember.js?body=1:37748
Backburner.run ember.js?body=1:6019
Ember.run ember.js?body=1:6427
handleRegisteredAction ember.js?body=1:37746
handleActionEvent ember.js?body=1:21917
Ember.handleErrors ember.js?body=1:908
(anonymous function) ember.js?body=1:21909
jQuery.event.dispatch jquery.js?body=1:4625
elemData.handle
这是我的控制器的样子:
App.GroupController = Ember.ObjectController.extend
invitation: (->
@store.createRecord 'invitation',
group: @get 'model'
).property 'model'
actions:
createInvitation: ->
controller = @
@get('invitation').save().then (invitation) ->
controller.get('model.invitations').addObject invitation
我不知道如何调试它。
这是我的模型和数据存储。
App.Invitation = DS.Model.extend
owner: DS.belongsTo 'user',
async: true
group: DS.belongsTo 'group'
App.Invitation.FIXTURES = [
{
id: 1
group: 1
user: 1
}
]
App.Store = DS.Store.extend
adapter: 'DS.FixtureAdapter'
我正在使用Ember 1.4.0
。