Reload model/update template on createRecord save


#1

I see this question is being ask all over again still don’t find solution that works for such a trivial task.

This url displays a list of navigations tabs for workspaces.

http://localhost:4200/users/1/workspaces

Each of tab resolves to

http://localhost:4200/users/1/workspaces/:wid

Also on the I have a button that suppose to create a new workspace as well as new tab.

Here how controller for looks:

export default Ember.Controller.extend({

    actions: {
        newWorkspace: function () {
            this.get('currentModel').reload();
            var self = this;

            var onFail = function() {
                // deal with the failure here
            };

            var onSuccess = function(workspace) {
                self.transitionToRoute('dashboard.workspaces.workspace', workspace.id);
            };

            this.store.createRecord('workspace', {
                title: 'Rails is Omakase'
            }).save().then(onSuccess, onFail);

        }
    }
});

When I click on button I see in ember inspector new record indeed created as well as url redirected to id that represents newly created workspace.

My question is how to force model/template to reload. I have already killed 5h trying model.reload() etc. Everything seem not supported no longer. Please please help.

UPDATE 1 When adding onSuccess

            model.pushObject(post);

throws Uncaught TypeError: internalModel.getRecord is not a function

UPDATE 2

Ember destroyed my life and ruined the summer. Every little progress comes with pain


#2

solution was to add record like like:

model.addObject(workspace._internalModel);