Created
June 26, 2015 13:40
-
-
Save brandonhilkert/121c1545b036f2eb3f88 to your computer and use it in GitHub Desktop.
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'; | |
export default Ember.Route.extend(AuthenticatedRouteMixin, { | |
model: function() { | |
var app = this.modelFor('apps/show'); | |
var adapter = this.container.lookup('adapter:application'); | |
var url = adapter.buildURL('app', app.get('id')) + '/metrics'; | |
adapter.ajax(url, 'GET').then(function(response) { | |
debugger | |
}); | |
} | |
}); |
Having said that, I think it's more idiomatic to do the following:
// app/models/app.js
export DS.Model.extend({
metrics: DS.belongsTo('metric', { async: true }),
})
// app/routes/apps/show/index.js
export default Ember.Route.extend({
model() {
const app = this.modelFor('apps/show');
return app.get('metrics');
}
})
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you plan to stick with this approach, you'll want to change
"adapter:application" to
"adapter:app"
(ifapp
is the name of the model)