Skip to content

Instantly share code, notes, and snippets.

@ksol
Created October 20, 2015 21:50
Show Gist options
  • Save ksol/36001fe6cf7b582de5c4 to your computer and use it in GitHub Desktop.
Save ksol/36001fe6cf7b582de5c4 to your computer and use it in GitHub Desktop.
import ApplicationAdapter from './application';
import UrlTemplates from "ember-data-url-templates";
export default ApplicationAdapter.extend(UrlTemplates, {
queryUrlTemplate: '{+host}/posts/{endpoint}',
urlSegments: {
endpoint(type, id, snapshot, query) {
// we're extracting the endpoint from the query object...
let ep = query.endpoint;
// ... and we delete it, so that the actual query does not contain
// a useless "endpoint"
delete query.endpoint;
return ep;
},
}
});
import Ember from 'ember';
export default Ember.Route.extend({
model() {
let query = {endpoint: "favorites"};
return this.store.query('post', query);
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment