'DS' is not defined


#1

I’m just starting out here and this is a little confusing. I created a model for a component that I’ve made. The model is defined as:

// app/models/upcoming-debates.js
var attr = DS.attr;

export default DS.Model.extend({
  title: attr(),
  createdAt: attr('date')
});

I thought that DS is instantiated by ember data, and that this is automatically loaded in when using ember-cli. What am I doing wrong here?


#2

You need to import DS using

 import DS from 'ember-data';

Try to use the ember generator

ember generate upcoming-debates title createdAt:date.

Look through the help,

ember g -h       #all generators
ember g model -h # help regarding model generator

#3

Brilliant - thanks very much!


#4

It should be ember generate model upcoming-debates title createdAt:date.