Upgrade to 2.1 and now 'Error while processing route:xxx Cannot read property 'extend' of undefined''


#1

All I did was update to Ember 2.1 and now I get the following error when loading: Error while processing route: landing-page Cannot read property ‘extend’ of undefined TypeError: Cannot read property ‘extend’ of undefined

import Ember from 'ember';

export default Ember.Route.extend({
    model : function() {
        return this.store.findAll('message');
    }
});

That’s it in the route.

import DS from 'ember-data';

export default DS.ActiveModelAdapter.extend({
    namespace : 'api',
    host : 'http://localhost:8000'
});

That’s the default adapter.

Here’s the message model:

import DS from 'ember-data';

export default DS.Model.extend({
    startdate : DS.attr('date'),
    enddate : DS.attr('date'),
    title : DS.attr('string'),
    message : DS.attr('string'),
    msgtype : DS.attr('number'),

    isNotam: Ember.computed.equal('msgtype', 0),
    isWelcomeMessage: Ember.computed.equal('msgtype', 1),
    isFeatureDestination: Ember.computed.equal('msgtype', 2),

    isDisplayed : Ember.computed('startdate','enddate', function() {
        var today = new Date();
        var sd = new Date(this.get('startdate'));
        var ed = new Date(this.get('enddate'));
        var display = (sd <= today && today <= ed);
        Ember.Logger.info('Displayed:' + display);
        return display;
    })
});

Here’s my bower.json:

{
  "name": "myapp",
  "dependencies": {
    "bootstrap": "~3.3.5",
    "ember": "2.1.0",
    "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.6",
    "ember-cli-test-loader": "ember-cli-test-loader#0.2.1",
    "ember-data": "2.1.0",
    "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.7",
    "ember-qunit": "0.4.13",
    "ember-qunit-notifications": "0.1.0",
    "ember-resolver": "~0.1.18",
    "jquery": "^1.11.3",
    "loader.js": "ember-cli/loader.js#3.3.0",
    "qunit": "~1.19.0"
  },
  "devDependencies": {
  }
}

I know it’s something silly, but I can’t find an answer that is dated this year… like most Ember docs.

Thanks for any advice.

JT


#2

Switch ActiveModelAdapter to RESTAdapter and it is working again.