marcioj / ember-cli-scaffold

Scaffolds models, routes and templates a la rails
https://github.com/marcioj/ember-cli-scaffold
43 stars 9 forks source link

Support for DataStore imports and syntax #33

Open jgamedev opened 8 years ago

jgamedev commented 8 years ago

This is what the scaffold gives me:

import Model from 'ember-data/model';
import attr from 'ember-data/attr';

export default Model.extend({ [..] });

This is what my model ended up looking after following the Ember official documentation:

import DS from 'ember-data';

const { attr, hasMany } = DS;
export default DS.Model.extend({
  name: attr('string'),
  products: hasMany('product')
});
marcioj commented 8 years ago

For consistency ember generate scaffold delegates the model creation to ember generate model. I think that creating some option to customize the import will not give any benefit, and make things more confuse. Maybe the ember documentation should be updated to use this new syntax.