ember.js - Not able to load the hasMany attribute in ember -


i getting error

assertion failed: passing classes store methods has been removed. please pass dasherized string instead of undefined. 

my model (likes)

url: attr('string'), detail_url: attr('string'), gallery_name: attr('string'), description: attr('string'), time: attr('string'), thumbnail_url: attr('string'), num_photos: attr('number'), num_photos_hifive: attr('number'), is_following:attr('number'), karma:attr('number'), photothumbs_hifive:ds.hasmany('thumb'), 

model (thumb)

photo: attr('string'), photo_url: attr('string'), 

serializer (same both )

 export default ds.jsonserializer.extend(ds.embeddedrecordsmixin,{  isnewserializerapi: true,  primarykey:'pk',  normalize: function(typeclass, hash) {  var fields = ember.get(typeclass, 'fields');  fields.foreach(function(field) {  var payloadfield = ember.string.underscore(field);   if (field === payloadfield) { return; }   hash[field] = hash[payloadfield];   delete hash[payloadfield]; }); return this._super.apply(this, arguments);  }  }); 

i able receive response form server.in ember inspector, "like" model showing data.but "thumb" model not showing data.when comment out " photothumbs_hifive:ds.hasmany('thumb'),".it works fine not populated thumb model.not sure why happening.

i had similar problem. error occurs if backend's response doesn't return json api document follows json api specification , conventions of examples found on http://jsonapi.org/format. see https://guides.emberjs.com/v2.3.0/models/customizing-serializers/ more info.

i solved following answer here: https://stackoverflow.com/a/34168112/5837307.

basically, modify like serializer use restserializer instead of jsonserializer , include embeded attributes in attr object in serializer.

in case like:

export default ds.jsonserializer.extend(ds.embeddedrecordsmixin,{     isnewserializerapi: true,     // . . .     attrs: {             photothumbs_hifive: { embedded: 'always' }     } }); 

Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -