Skip to content

Instantly share code, notes, and snippets.

@stravid
Last active August 29, 2015 13:59
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 stravid/10713318 to your computer and use it in GitHub Desktop.
Save stravid/10713318 to your computer and use it in GitHub Desktop.
Fixtures in combination with Ember CLI. Read more about it here: http://edgycircle.com/blog/2014-using-fixtures-in-combination-with-ember-cli/
// The incorrect way of defining fixtures.
var Post = DS.Model.extend({
title: DS.attr('string'),
body: DS.attr('string')
});
Post.FIXTURES = [
{ id: 1, title: 'Title A', body: 'Body A' },
{ id: 2, title: 'Title B', body: 'Body B' }
];
export default Post
// The correct way of defining fixtures.
var Post = DS.Model.extend({
title: DS.attr('string'),
body: DS.attr('string')
});
Post.reopenClass({
FIXTURES: [
{ id: 1, title: 'Title A', body: 'Body A' },
{ id: 2, title: 'Title B', body: 'Body B' }
]
});
export default Post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment