lundi 27 juillet 2015

Ember Route Snapshot is null

I am trying to create a custom buildURL method to hit my server which has a route /blog/1/posts. In my posts route I have:

import Ember from 'ember';

export default Ember.Route.extend({
  model: function(params, transition) {
     var blog_id = transition.params['blog.show'].blog_id;
     return this.store.findAll('post', { blog_id: blog_id });
  }
});

and my postAdapter I have:

import ApplicationAdapter from './application';

export default ApplicationAdapter.extend({
  buildURL: function(type, id, snapshot, requestType, query) {
    return(
      this.get('namespace') +
        '/blog/' + snapshot.get('blog.id') +
        '/posts'
    )
  }
});

but snapshot is always null. How do I go about creating a snapshot to inject into these methods?

Any help would be appreciated. thanks!




Aucun commentaire:

Enregistrer un commentaire