hasMany not updating ember store
Question: I am using ember django adapter as my backend is designed in
python/django.(<http://dustinfarris.com/ember-django-adapter/>)

feed.js (model)

    
    
    import DS from 'ember-data';
    
    const {attr} = DS
    
    export default DS.Model.extend({
         gallery_name:attr('string'),
         thumbnail_url:attr('string'),
         is_following:attr('boolean'),
         time:attr('string'),
         description:attr('string'),
         feedPhotos:DS.hasMany('feedPhoto',{embedded:'always'})
    });
    

feedphoto.js(model)

    
    
    import DS from 'ember-data';
    
    export default DS.Model.extend({
      feed: DS.belongsTo('feed'),
      url: DS.attr(),
      profilePic: DS.attr(),
      userName: DS.attr(),
      userKarma: DS.attr(),
      caption: DS.attr(),
      numComments: DS.attr(),
      owner: DS.attr(),
      time: DS.attr(),
      photo_url: DS.attr(),
      comments_url: DS.attr(),
      numFives: DS.attr(),
      fivers_url: DS.attr(),
      fivers_pk: DS.attr(),
      fullphoto_url: DS.attr(),
      fullphoto_pk: DS.attr(),
      is_fived: DS.attr('boolean'),
      hiFiveKarma: DS.attr(),
      owner_pk: DS.attr(),
      userFirstName: DS.attr(),
      is_bookmarked: DS.attr('boolean')
    });
    

feed.js(serializer)

    
    
    import DRFSerializer from './drf';
    import DS from 'ember-data';
    
    export default DRFSerializer.extend(DS.EmbeddedRecordsMixin,{
      primaryKey: 'pk',
      attrs:{
        feedPhotos:{ embedded: 'always' }
      }
    });
    

feedphoto.js(serailizer)

    
    
    import DRFSerializer from './drf';
    import DS from 'ember-data';
    
    export default DRFSerializer.extend({
      primaryKey: 'pk',
    });
    

response.json

    
    
    [{
        "pk": 127,
        "url": "http://example.com/api/galleries/127/",
        "gallery_name": "Faces",
        "thumbnail_url": "https://dz.cloudfront.net/galleryThumbs/2656a05c-4ec7-3eea-8c5e-d8019454d443.jpg",
        "time": "1 month ago",
        "description": "Created by user",
        "is_following": true,
        "feedPhotos": [{
            "pk": 574,
            "url": "http://examle.com/api/photos/574/",
            "profilePic": "https://d3.cloudfront.net/userDPs/b6f69e4e-980d-3cc3-8b3e-3eb1a7f21350.jpg",
            "userName": "Rohini",
            "userKarma": 194,
            "caption": "Life @ Myanmar!",
            "numComments": 0,
            "owner": "http://example.cloud.net/api/users/45/",
            "time": "2 months ago",
            "photo_url": "https://example.cloud.net/photos/eeae72d5-d6af-391e-a218-b442c0c7e34e.jpg",
            "comments_url": "http://example.cloud.net/api/photos/574/comments/",
            "numFives": 2,
            "fivers_url": "http://example.cloud.net/api/photogalleries/1303/fivers/",
            "fivers_pk": 1303,
            "fullphoto_url": "http://example.cloud.net/api/photogalleries/1303/photo/",
            "fullphoto_pk": 1303,
            "is_fived": false,
            "hiFiveKarma": 0,
            "owner_pk": 45,
            "userFirstName": "Rohini",
            "is_bookmarked": false
        }, {
            "pk": 446,
            "url": "http://example.cloud.net/api/photos/446/",
            "profilePic": "https://example.cloud.net/userDPs/b359fab0-211d-32b5-8f13-f5edbeb0fbf9.jpg",
            "userName": "Shushma",
            "userKarma": 224,
            "caption": "",
            "numComments": 0,
            "owner": "http://example.cloud.net/api/users/34/",
            "time": "2 months ago",
            "photo_url": "https://example.cloud.net/photos/a415ed45-b6e5-33e0-a17e-6452ddb2f258.jpg",
            "comments_url": "http://example.cloud.net/api/photos/446/comments/",
            "numFives": 3,
            "fivers_url": "http://example.cloud.net/api/photogalleries/1315/fivers/",
            "fivers_pk": 1315,
            "fullphoto_url": "http://example.cloud.net/api/photogalleries/1315/photo/",
            "fullphoto_pk": 1315,
            "is_fived": false,
            "hiFiveKarma": 0,
            "owner_pk": 34,
            "userFirstName": "Shushma",
            "is_bookmarked": false
        }]
    }]
    

The code is able to save the feed model details but not the feedphoto model.In
my ember inspector the feed model show the correct data.But the feedphoto
model is not showing any data.My not sure why I am going wrong.


Answer: I think you have two problems

  1. the capital letter in: `DS.hasMany('feedPhoto',{embedded:'always'})`. This would mean, that your model file should be named 'feed-photo.js' or 'feed_photo.js'. 
  2. Also, I haven't worked with the ember-django-adapter yet, but they usually interprete the `feed_photos` coming as a response as a `feedPhoto` ember relation. So you should probably return as `feed_photos` from your server instead of `feedPhotos` or rename the attribute to `feedphotos`

