0
votes

Using ember-cli with ember-cli-coffeescript installed. If I define a model named Person in pure javascript (see below) it works just fine.

file: models/person.js

import DS from 'ember-data';

export default DS.Model.extend({
  nome: DS.attr('string')
});

But when I try to use coffeScript I get an error message stating that the Person model is not defined. See the coffeScript bellow, what am I missing here?

`import DS from 'ember-data';`

Person = DS.Model.extend
  nome: DS.attr('string')

`export default Person;`
1

1 Answers

1
votes

There are some requirements to be met for your code to run fine:

  • ember-cli-coffeescript installed
  • file extension is .coffee
  • full path: app/models/person.coffee
  • no app/models/person.js present at the same time (when person.coffee is present)

Everything should be working without using ; after import and after export:

`import DS from 'ember-data'`

Person = DS.Model.extend
  nome: DS.attr 'string'

`export default Person`