ember.js - Cannot read property 'match' of undefined at Ember.DefaultResolver.extend.podBasedComponentsInSubdir -


i'm getting opaque error message (opaque in sense have no point of reference own source) console, i'm not entirely sure look, feel it's error in library code before posting on github i'll double check it's not own fault.

the problem

the problem simple, i'm calling this.store.find('player'), in hopes list of players, , display them in kind of list, i'm not getting past loading part. data pulled server , looks formatted, seems failing after route.model method call. , error message seems somewhere in ember.js library code nothing pointing own code.

server response

the content type of course application/json, , note id property _id.

[   {     "_id":"55405a5102b4ed623c225e87",     "alias":"miketest",     "__v":0,     "scans":[],     "createdat":"2015-04-29t04:13:05.223z"   } ] 

error message

note there part of stack trace pointing source, ember source. has made pain debug.

error while processing route: leader cannot read property 'match' of undefined typeerror: cannot read property 'match' of undefined     @ ember.defaultresolver.extend.podbasedcomponentsinsubdir (http://localhost:4200/assets/vendor.js:60138:76)     @ http://localhost:4200/assets/vendor.js:60190:34     @ array.exports.default.mixin.mixin.create.find (http://localhost:4200/assets/vendor.js:39572:30)     @ ember.defaultresolver.extend.findmodulename (http://localhost:4200/assets/vendor.js:60188:44)     @ resolveother (http://localhost:4200/assets/vendor.js:60051:37)     @ superwrapper (http://localhost:4200/assets/vendor.js:28141:20)     @ exports.default.emberobject.default.extend.resolve (http://localhost:4200/assets/vendor.js:15454:35)     @ object.resolve [as resolver] (http://localhost:4200/assets/vendor.js:15217:23)     @ resolve (http://localhost:4200/assets/vendor.js:12792:29)     @ object.registry.resolve (http://localhost:4200/assets/vendor.js:12336:21) 

source

this ember app young, there little source @ moment, relevant source @ moment.

routes

import ember 'ember'; import config './config/environment';  var router = ember.router.extend({   location: config.locationtype });  export default router.map(function() {   this.resource('leader');   this.resource('profile');   this.route('loading'); }); 

leader route

leader has template , controller, empty right now.

import ember 'ember';  export default ember.route.extend({   model: function () {     return ember.rsvp.hash({       players: this.get('store').find('player')     });   }, }); 

player model

import ds 'ember-data';  export default ds.model.extend({   alias: ds.attr('string'),   createdat: ds.attr('date'),   scans: ds.hasmany('scan'), }); 

application adapter

import ds 'ember-data';   export default ds.restadapter.extend({   namespace: '' }); 

application serialiser

import ds 'ember-data';  export default ds.restserializer.extend({   primarykey: function (type) {     return '_id';   },    serializeid: function(id) {     return id.tostring();   } }); 

versions

i'm not sure if of versions here particularly important

  • ember-cli 0.2.3
  • ember-data 1.0.0-beta.16.1
  • ember 1.11.1

things i've tried

  • removing properties model, in event relationships seemed problem (nothing changed)
  • tried setting serialiser , adapter application (included above), nothing changed.
    • the serialiser in event id field in response _id.
  • tried updating ember data, nothing changed.

okay figured out being done wrong... forgot check if data being returned server abides convention/protocol required use ember data. json returned server looks this.

[   {     "_id":"55405a5102b4ed623c225e87",     "alias":"miketest",     "__v":0,     "scans":[],     "createdat":"2015-04-29t04:13:05.223z"   } ] 

it should this

{   "players": [     {       "_id":"55405a5102b4ed623c225e87",       "alias":"miketest",       "__v":0,       "scans":[],       "createdat":"2015-04-29t04:13:05.223z"     }   ] } 

so yes me being dumb , missing something.

why required

ember data expects json returned server meet json api standard, standard specifies formatting of json returned server. in case, data didn't meet json api standard, forgot put array of players under key called players. there more examples of in ember v1.10.0 guide models.

the reason ember data expects ember data can make assumptions data returned server.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -