user762579
user762579

Reputation:

ember-cli (2.4.3) not generating DS models

I am very surprised not to get DS models upon generating ember-cli model

ember -v
ember-cli: 2.4.3
node: 5.10.1
os: darwin x64

ember g model rental

Then I get :

// app/models/rentals
import Model from 'ember-data/model';
export default Model.extend({
});

according to the ember guide , I should get :

// app/models/rentals
import DS from 'ember-data';
export default DS.Model.extend({
});

what could be wrong ? thanks for feedback

Upvotes: 0

Views: 109

Answers (2)

CS Pei
CS Pei

Reputation: 11047

The new generated code should look like the following,

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


export default Model.extend({
    title: attr('string'),
    owner: attr('string')
});

Upvotes: 1

locks
locks

Reputation: 6577

There is nothing wrong with the generated code :)

Ember Data has been made an addon, and part of that work was to tweak the public ES6 modules so everything doesn't hang off of the DS object. Now you can directly import the Model like in the first code sample you show.

I have opened an issue on the Guides repository to fix the Tutorial section of the guides.

Upvotes: 1

Related Questions