Created
October 18, 2015 14:47
-
-
Save ksol/b6d495109ede207c68e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UrlTemplates from "ember-data-url-templates"; | |
export default DS.RESTAdapter.extend(UrlTemplates, { | |
urlTemplate: '{+host}/posts/{postId}/comments{/id}', | |
findUrlTemplate: '{+host}/comments/{id}', | |
createRecordUrlTemplate: '{+host}/users/{userId}/comments', | |
currentUser: Ember.inject.service(), | |
urlSegments: { | |
postId(type, id, snapshot, query) { | |
return snapshot.belongsTo('post', { id: true }); | |
}, | |
userId() { | |
return this.get('currentUser.id'); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I fixed a small typo in my fork, if you're interested: https://gist.github.com/GabrielCW/da2c95ace69913885513