I'm using the latest version of ember-data (rev. 11) and the REST adapter to pull data from my API. A sample of the returned JSON looks like this:
{
"events": [
{
"id": "5118dd8c4c80866ef2000051",
"title": null,
"starts_at": 1361901600,
"ends_at": null,
"currency": "SEK",
"cents_door": 4000,
"cents_advance": null,
"price_door": "40.00 kr",
"price_advance": null,
"age_limit": null,
"venue_section": "PLAYHOUSE",
"description": null,
"url": null,
"repeats": null,
"repeats_until": null,
"venue_id": "nefertiti-jazz-club",
"act_ids": [ "marias-playhouse" ]
}
]
}
The model looks like this:
App.Event = DS.Model.extend
title: DS.attr('string')
startsAt: DS.attr('number')
endsAt: DS.attr('number')
currency: DS.attr('string')
centsDoor: DS.attr('number')
centsAdvance: DS.attr('number')
priceDoor: DS.attr('string')
priceAdvance: DS.attr('string')
ageLimit: DS.attr('string')
venueSection: DS.attr('string')
description: DS.attr('string')
url: DS.attr('string')
repeats: DS.attr('string')
repeatsUntil: DS.attr('string')
venue: DS.belongsTo('App.Venue')
acts: DS.hasMany('App.Act')
But when requesting the data, the request completes successfully, but I get this error in the console:
Uncaught Error: assertion failed: Your server returned a hash with the key events but you have no mapping for it
Any ideas what's going wrong here?
===
UPDATE: As requested I'm adding a bit more of my Ember.js app.
My RESTAdapter setup:
DS.RESTAdapter.registerTransform 'raw',
deserialize: (serialized) ->
serialized
serialize: (deserialized) ->
deserialized
App.Store = DS.Store.extend
adapter: DS.RESTAdapter.create
url: LJ.CONFIG.api.url
revision: 11
And routes:
App.Router.map ->
this.resource 'events', ->
this.route 'new'
this.resource 'event', path: '/events/:event_id', ->
this.route 'edit'
this.resource 'venue', path: '/venues/:venue_id', ->
this.route 'edit'
this.resource 'events'
this.resource 'act', path: '/acts/:act_id', ->
this.route 'edit'
this.resource 'events'
this.route 'search', path: '/search/:term'
this.route 'doc', path: '/docs/:doc'