ember.js - Add fixtures with ember-cli 0.1.2 -


This is the same question, but it seems that the code generated by ember-cli has changed . This is my current system:

  »Amber - version version: 0.1.2 node: 0.10.25 npm: 2.1.3  

This is my book model Full content of file ( model / book.js ):

Import the DS from 'ember-data'; Export Default DS.Model.extend ({'title': DS.attr ('string'), 'author': DS.attr ('string'),});

Answer other questions and tell me to use reopenClass , but there is nothing to open me again with the current format of the model file.

I have tried to:

imported DS from 'ember-data'; Export Default DS.Model.extend ({'title': DS.attr ('string'), 'author': DS.attr ('string'), fixtures: [{ID: 1, title: "mentor", author : "Larry Nieven"}, {ID: 2, Title: "The Greatest Book Ever", Author: "Juan"}]});

But there is no luck. I should

in my model class
Let's move on. Store the model in one variable, open the class again and add the fixtures, then export the model.

Import ds from 'ember-data'; Var BookModel = DS.Model.extend ({'title': DS.attr ('string'), 'author': DS.attr ('string')}); BookModel.reopenClass ({Fixtures: [ID: 1, Title: "Patron", Author: "Larry Nieven"}, {ID: 2, Title: "The Greatest Book Ever", Author: "Juan"}]}) ; Export default bookmodel;