ember-cli-scaffold icon indicating copy to clipboard operation
ember-cli-scaffold copied to clipboard

Support for DataStore imports and syntax

Open jgamedev opened this issue 8 years ago • 1 comments

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')
});

jgamedev avatar Jun 05 '16 00:06 jgamedev

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.

marcioj avatar Jun 06 '16 23:06 marcioj