My RESTAdapter config:
App.ApplicationAdapter = DS.RESTAdapter.extend
namespace: '/api'
My model:
module.exports = App.Cat = DS.Model.extend
name: DS.attr 'string'
description: DS.attr 'string'
picture: DS.attr 'string'
location: DS.attr 'string'
profileStyle: DS.attr 'string'
created: DS.attr 'date'
My route:
Cat = require '../../models/cat'
App.CatNewRoute = Em.Route.extend
model: ->
@store.createRecord(Cat, {
created: new Date()
})
My controller:
App.CatNewController = Em.ObjectController.extend
actions:
addCat: ->
console.log 'saving...'
@get('model').save().then ->
console.log 'all done'
I've verified with the Ember inspector that my model has all the attributes that get assigned through a form on the template at the time of save (except for an id which is null - I think this is normal and Ember by default uses the ID assigned to a model by the server). Whenever I save the model I get the error:
Uncaught TypeError: Cannot read property 'typeKey' of undefined
This error occurs here in the ember data source code:
if (container) {
adapter = container.lookup('adapter:' + type.typeKey) || container.lookup('adapter:application');
}
I'm using Ember-data 1.0.0 beta 3-2 and Ember 1.0.0-4. I've tried a few different versions of Ember data to the same effect.
Close approximation in jsBin: http://jsbin.com/ixIqIjI/6/edit?html,js,console,output
This jsBin also errors with the typeKey error.