Loading partial models then filling them with Ember-data

I’ve been trying to figure this out for a while and think I finally stumbled on something that works pretty well for me, YMMV.

I just overrode the preprocessData function on my App.Store to check if the data I’m supplying is a full item or partial, based on the attribute basicInfo, then checks to see if the item is already in the Store, and returns accordningly Here’s what my App.Store looks like now

App.Store = DS.Store.extend(
  revision: 12

  preprocessData: (type, data) ->

    if data.basic_info && this.hasReferenceForId(type, data.id)
      return unless this.find(type, data.id).get('basicInfo')

    @_super(type, data)

)
2 Likes