Created
October 20, 2015 22:15
-
-
Save ksol/32fabbc6ad8aa8fbf068 to your computer and use it in GitHub Desktop.
Revisions
-
ksol created this gist
Oct 20, 2015 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ import Ember from "ember"; import DS from "ember-data"; export default DS.Model.extend({ // Your ED relationships and properties here... // ... // Custom API upvote() { this.set('_updateEndpoint', 'upvote'); let promise = this.save(); promise.finally(() => this.set('_updateEndpoint', null)); return promise; }, downvote() { this.set('_updateEndpoint', 'downvote'); let promise = this.save(); promise.finally(() => this.set('_updateEndpoint', null)); return promise; }, });