Created
August 11, 2015 15:43
-
-
Save mattweldon/67fc6305c33e9ff3c7d5 to your computer and use it in GitHub Desktop.
dfdf
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 characters
import DS from "ember-data"; | |
export default DS.RESTAdapter.extend({ | |
host: 'http://localhost:4101/api/v1', | |
buildURL: function(root, suffix, record) { | |
var url = this._super(); | |
return url + '/posts/' + suffix + '/versions'; | |
} | |
}); |
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 characters
import DS from 'ember-data'; | |
export default DS.Model.extend({ | |
post_id: DS.attr('number'), | |
version: DS.attr('number'), | |
test: DS.attr('string') | |
}); |
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 characters
import Ember from 'ember'; | |
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin'; | |
var PostsRoute = Ember.Route.extend({ | |
model: function(params) { | |
var _this = this; | |
var posts = _this.store.find('post'); | |
posts.then( | |
function(postList) { | |
var mostRecentPost = postList.get('lastObject'); | |
var recentPostInfo = _this.store.find('post-version', mostRecentPost.get('id')); | |
}, | |
function(resolve) { } | |
); | |
} | |
}); | |
export default PostsRoute.extend(AuthenticatedRouteMixin); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment