Skip to content

Instantly share code, notes, and snippets.

@mattweldon
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattweldon/75e8690515ae026b5188 to your computer and use it in GitHub Desktop.
Save mattweldon/75e8690515ae026b5188 to your computer and use it in GitHub Desktop.
Ember Nested URLs Error
// ...
model: function(params) {
// ...
var versions = _this.store.findRecord('post-version', post.get('id'));
// http://localhost:4101/api/v1/posts/1/versions gets called correctly...
// ... but then BOOM. "Cannot read property '_internalModel' of undefined"
// ...
}
// ...
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';
}
});
import DS from 'ember-data';
export default DS.Model.extend({
post_id: DS.attr('number'),
version: DS.attr('number'),
title: DS.attr('string'),
body: DS.attr('string')
});
{
"post_versions": [
{"id":13,"post_id":65,"version":1,"title":"test title", "body":"test body"}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment