Nico
Nico

Reputation: 792

Ember data: findRecord is undefined. (also peekRecord or peekAll)

I'm trying to switch to ember-data and I cant seem to find a solution to this error:

TypeError: this.store.findRecord is not a function. (In 'this.store.findRecord('feed', feed_id)', 'this.store.findRecord' is undefined)

This is my code inside the controller as an action:

    toggleArchive(feed_id, param,intercom_event){
        var self = this;
        this.set('isLoading',true);

        return this.store.findRecord('feed', feed_id).then(function(feed) {
            //Setting the system_status of the feed to either 4 (archived) or 1 (normal)
            feed.set('system_status',param);
            //Persist to change to store (and server)
            return feed.save();
        });
    },

On the route I call :

model: function(params){
    return this.store.findRecord('feed',params.feed_id);
},

And in package.json im using : "ember-data": "1.13.8",

If I call the old this.store.find() method, the record is retrieved, but this is not ideal as the method is being deprecated and I doesn't work as expected.

Any hints on what I might be doing wrong?

Thanks :)

Upvotes: 1

Views: 1303

Answers (1)

Daniel
Daniel

Reputation: 18672

You also need package entry for Ember Data in bower.json:

"ember-data": "1.13.8"

Upvotes: 1

Related Questions