abuiles / ember-cli-101-errata

18 stars 4 forks source link

Page 14: article adapter should include ApplicationAdapter #170

Closed jbinto closed 9 years ago

jbinto commented 9 years ago

On page 14, we have the following code snippet:

export default ApplicationAdapter.extend({
  buildURL: function(type, id , record) {
    return '/friends/' + record.get('friend.id') + '/articles/' + id;
  }
});

This makes JSHint complain:

adapters/article.js: line 1, col 16, 'ApplicationAdapter' is not defined.

At that point, I just made the compiler happy by adding

import ApplicationAdapter from 'ember';  // wrong, but it compiles

But by the time I made it to Page 61, where you attempt to do this in the console:

$E.get('articles').createRecord({description: 'foo'})

I got a hard-to-track-down Uncaught TypeError: undefined is not a function.

I now realize that the correct thing to do in article.js is:

import ApplicationAdapter from './application';

So page 14 should be updated with that import.

jbinto commented 9 years ago

See #172. ArticleAdapter isn't actually supposed to be implemented.