Use Model in Helper with Ember App Kit


#1

Hi,

I’m actually refactoring a rails-ember app into 2 applications, an api and a front-end app. While I was moving the differents part of the ember application , I had to implement a Helper using a model, i did this:

import Language from "appkit/models/language";
export default Ember.Handlebars.makeBoundHelper(function(initials){
   var languages = Language.find();
   var record = languages.filterBy("initials", initials.toLowerCase())[0];
   if(record !== undefined){
     var name = record.get("name");
     return name.capitalize(); 
    }
});

But it looks like I can’t use Language.find() as a model, even if Language is a (subclass of DS.Model), the log tells me that Language has no method 'find'. This was working perfectly with ember JS so I presume it’s something with the es6 modules. Any thoughts ?


#2

Calling find directly on the model class was eliminated in ember-data.1.0.beta.1, see here.