rlivsey/fireplace

Assertion failed....

DennisVanRijswijk opened this issue · 3 comments

If i use FirePlace's current version (changed 10 days ago) i get this error when i run my Ember app:

Assertion failed: Error while loading route: TypeError: Object # has no method 'pluralize' ember.js:3231
(anonymous function)ember.js:3231
defaultActionHandlers.errorember.js:31849
triggerEventember.js:31925
triggerember.js:30820
Transition.triggerember.js:30041
handleErrorember.js:31154
invokeCallbackember.js:8295
(anonymous function)ember.js:8349
EventTarget.triggerember.js:8118
(anonymous function)ember.js:8420
DeferredActionQueues.flushember.js:5591
Backburner.endember.js:5682
Backburner.runember.js:5721
Ember.runember.js:6082
(anonymous function)ember.js:36364
cjquery-1.10.2.js:3048
p.fireWithjquery-1.10.2.js:3160
x.extend.readyjquery-1.10.2.js:433
q

When i include ember-data.js it is working and receiving data from Firebase!.
But than i get this error(s) because ember-data.js is already doing the Application initialize :

  • Assertion failed: The initializer 'store' has already been registered
  • Assertion failed: The initializer 'transforms' has already been registered
  • Assertion failed: The initializer 'dataAdapter' has already been registered
  • Assertion failed: The initializer 'injectStore' has already been registered

Fireplace uses ember inflector for pluralisation, so you'll need to have that loaded too (or override the firebase path generation which uses the inflector).

The ember data build comes packaged with the inflector, so that's why it makes the error go away when you have both loaded, although they won't play nicely with each other as you've seen.

Thanks for your fast answer!
If i load the ember inflector as you mentioned i get this error:

Assertion failed: Error while loading route: TypeError: Object # has no method 'pluralize' ember.js:3231
(anonymous function) ember.js:3231
defaultActionHandlers.error ember.js:31849
triggerEvent ember.js:31925
trigger ember.js:30820
Transition.trigger ember.js:30041
handleError ember.js:31154
invokeCallback ember.js:8295
(anonymous function) ember.js:8349
EventTarget.trigger ember.js:8118
(anonymous function) ember.js:8420
DeferredActionQueues.flush ember.js:5591
Backburner.end ember.js:5682
Backburner.run ember.js:5721
Ember.run ember.js:6082
(anonymous function) ember.js:36364
c jquery-1.10.2.js:3048
p.fireWith jquery-1.10.2.js:3160
x.extend.ready jquery-1.10.2.js:433
q

I'ts almost the same error as showed before.. but probably it's my lack of experience to the Ember framework why i can't get it up and running.

It still looks like you aren't loading inflector, which adds the pluralize method. Make sure it comes before fireplace, and after ember, in your dependency order.

On a related note, I could get inflector loaded fine, but it was saying that my firebasePath was "model)s". Looking at the code for firebasePath:

function (){
    Ember.assert('ember-inflector not found, install or manually set firebasePath references', Ember.String.pluralize);
    var className = this.toString().split('.').pop();
    return Ember.String.pluralize(Ember.String.underscore(className));
  } 

this.toString returns "(subclass of FP.Model)". I take it that this should be returning the name of my model. The only way I've been able to move past this is to, like you say, set firebasePath explicitly. I'm using RequireJS modules, so I don't know if that's somehow breaking things, but it shouldn't in any case. I'm using Ember 1.5.0-beta.4, fwiw.