emberjs / ember-inspector

Adds an Ember tab to the browser's Developer Tools that allows you to inspect Ember objects in your application.
MIT License
966 stars 286 forks source link

Assertion Failed: Cannot find model name error #389

Closed CharlieHawker closed 9 years ago

CharlieHawker commented 9 years ago

I'm having the following error with the inspector when I use it on my (very bare thus far) app. I'm new to Ember so it may be something I'm doing wrong, but given the app is behaving as expected, I'll log it anyway:

Ember Inspector has errored.
This is likely a bug in the inspector itself.
You can report bugs at https://github.com/emberjs/ember-inspector.
Error message: Assertion Failed: Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support
Stack trace: Error: Assertion Failed: Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support
    at new Error (native)
    at Error.EmberError (http://localhost:5000/assets/ember-template-compiler.self-6d2ad5251a130420080d16651db0fd4818193b3f6dcb22dbc557a2a348afc742.js?body=1:3600:21)
    at Ember.default.assert (http://localhost:5000/assets/ember-template-compiler.self-6d2ad5251a130420080d16651db0fd4818193b3f6dcb22dbc557a2a348afc742.js?body=1:132:13)
    at Ember.DataAdapter.extend.getRecords (http://localhost:5000/assets/ember-data.self-3b1d8c3a088ab31d11fade914666e5f5df47c2e248b4f61c2dc862a574ef3401.js?body=1:11752:9)
    at exports.default.EmberObject.default.extend.wrapModelType (http://localhost:5000/assets/ember.self-0a7694e6958cccd02165183851df1b8c6f5553da7aea63ba96655b2b8e8f2700.js?body=1:5404:26)
    at http://localhost:5000/assets/ember.self-0a7694e6958cccd02165183851df1b8c6f5553da7aea63ba96655b2b8e8f2700.js?body=1:5227:28
    at Array.map (native)
    at exports.default.EmberObject.default.extend.watchModelTypes (http://localhost:5000/assets/ember.self-0a7694e6958cccd02165183851df1b8c6f5553da7aea63ba96655b2b8e8f2700.js?body=1:5225:32)
    at Ember.Object.extend.messages.getModelTypes (<anonymous>:773:55)
    at Object.apply (http://localhost:5000/assets/ember-template-compiler.self-6d2ad5251a130420080d16651db0fd4818193b3f6dcb22dbc557a2a348afc742.js?body=1:9766:18)

My app at present consists of the following code:

App = Ember.Application.create({
  LOG_TRANSITIONS: true
});
App.ApplicationAdapter = DS.ActiveModelAdapter.extend({
  namespace: 'api/v1'
});
App.TripType = DS.Model.extend({
  title: DS.attr('string')
});
App.ApplicationRoute = Ember.Route.extend({
  setupController: function(controller) {
    controller.set('trip_types', this.store.find('trip_type'));
  }
});
App.ApplicationController = Ember.Controller.extend();

and the template which renders the found trip types is:

<div class="app">
  <header class="app__header">
    <h1>Test</h1>

    {{ view "select"
       content=trip_types
       optionValuePath="content.id"
       optionLabelPath="content.title"
       prompt="Choose a Trip Type" }}
  </header>

  <div class="app__main">
    {{ outlet }}
  </div>

  <footer class="app__footer">
    &copy; Copyright 2015
  </footer>
</div>

As mentioned, API request working successfully and populating the select box, so I'm not sure why I'm getting the error. The error is triggered when I try to select the data tab in the ember inspector.

FYI, using Chrome 43.0.2357.124 on OS X Yosemite 10.10.1 and Ember 1.12.1 with Ember Data as fetched just now via ember-rails gem generator - rails g ember:install.

teddyzeenny commented 9 years ago

Unfortunately, As the error says "Please upgrade to Ember.js >= 1.13 for Ember Inspector support", latest Ember Data does not have Ember Inspector support unless you use Ember >= 1.13. (It also requires the latest Ember Inspector which will be released this weekend).

CharlieHawker commented 9 years ago

Ah right, thanks. I did see that and wonder why Ember Inspector was suggesting a beta version of Ember! That answers it, thanks.

poserr commented 9 years ago

So having Ember : 1.13.0-beta.2 and Ember Data : 1.0.0-beta.19.1 won't work before you release latest Ember Inspector? Any workarounds?

teddyzeenny commented 9 years ago

@poserr you could install the Ember Inspector from source.

jpaas commented 9 years ago

I've tried building from source every version back to 1.7.3 and I still get: Assertion Failed: Cannot find model name. Please upgrade to Ember.js >= 1.13 for Ember Inspector support

I can't upgrade to 1.13 yet because it breaks ember-intl. My environment:

DEBUG: -------------------------------
ember.debug.js:4874DEBUG: Ember                       : 1.12.1
ember.debug.js:4874DEBUG: Ember Data                  : 1.0.0-beta.19.2
ember.debug.js:4874DEBUG: jQuery                      : 2.1.4
ember.debug.js:4874DEBUG: Ember Simple Auth           : 0.8.0-beta.3
ember.debug.js:4874DEBUG: Ember Simple Auth OAuth 2.0 : 0.8.0-beta.3
ember.debug.js:4874DEBUG: Ember Simple Auth Testing   : 0.8.0-beta.3
ember.debug.js:4874DEBUG: -------------------------------
teddyzeenny commented 9 years ago

@jpaas Ember Inspector 1.8.2 was released, so no need to build from source.

As the error message says, the latest Ember Data (1.0.0-beta.19) requires Ember >= 1.13 to work with the inspector. Your options are to either downgrade Ember Data to <= beta.18, upgrade Ember to 1.13, use ember-cli, or not use the Ember Inspector Data pane until you upgrade Ember.

jpaas commented 9 years ago

I didn't realize a downgrade to Ember Data beta 18 would help. That I may be able to do. Thanks @teddyzeenny