2
votes

I'm rendering a model into a parent template like this:

{{render "teacher" teacher}}

Here's it's controller:

App.TeacherController = Ember.ObjectController.extend(App.EditableModelMixin, {
    actions: {
        saveTypes: function() {
            if (this.get('model')) console.log('Exists');
            console.log(this.get('model'));
            console.log(this.get('model').get('isFulfilled'));
            this.get('model').save();
        }
    }
});

Here's the output when this method is called:

Exists
Class {isFulfilled: true, toString: function, constructor: function, reason: null, isPending: undefined…}
true
Uncaught TypeError: Object [object Object] has no method 'save'

This way of doing things has had no problems for me before. It only seems to happen when I use render.

Update

Here's a screen shot of me looking at the TeacherController in Ember Inspector:

TeacherController

And another of just my view hierarchy:

View

1
Can you show what teacher is in the parent controller, I suspect it might be an item controllerKingpin2k
I'm trying to find a way to do that. How should I go about it?blaineh
I mean, I'm not sure what you mean. I could show you my model definition, or a console log, or the ember debugger's print out.blaineh
Here's a pastebin showing a console log, expanded so you can see some important things. pastebin.com/zpEM5xsPblaineh
Sorry, work blocks imgur, had I seen your image yesterday I probably could have helped easier, my badKingpin2k

1 Answers

2
votes

It appears as if that model is a PromiseObject (from an async mapping). Promise objects are an extension of Ember.ObjectProxy which will proxy property calls down to the real model if it exists, but the methods aren't proxied.

   var modelPromise = this.get('model');
   modelPromise.then(function(actualModel){
     actualModel.save();
   });