Saved record's data dont appeared in record list with ember-model[SOLVED]

I’m using ember-model with ember-app-kit for my bookmarkApp example i have a BookmarksNewRoute route for adding new bookmarks :

// routes/bookmarks/new.js
import Bookmark from 'appkit/models/bookmark';
var BookmarksNewRoute = Ember.Route.extend({
    model: function() {	
	    return Bookmark.create({});
    }
});
export default BookmarksNewRoute;

and following BookmarksNewController:

// controllers/bookmarks/new.js
var BookmarksNewController = Ember.ObjectController.extend({
    actions:{
	save: function(){	    
	    this.get("model").save();
	    this.transitionToRoute("bookmarks.index");
	}
    }
});
export default BookmarksNewController;

when i trigger the save action with a form of bookmark data it successfully send post request and save this bookmark in backend BUT after transitioning to “bookmarks.index” it show a empty row without data just when i refresh the page it show this bookmark’s data!! I’ve inspected this with emberInspector it shows that bookmark object’s field is null !!!

Image: Dropbox - Selection_001.jpg - Simplify your life

this.get("model").save().then =>
  this.transitionToRoute("bookmarks.index");

Dont work :frowning:

import Bookmark from 'appkit/models/bookmark';

var BookmarksNewController = Ember.ObjectController.extend({
    actions:{
	save: function(){
	    var that = this;
	    this.get("model").save().then(function(){
		that.transitionToRoute("bookmarks.index");
	    }); 
	}
    }
});

export default BookmarksNewController;

Based on the code samples you have provided, this is the correct solution. Debug harder, or supply more code samples

1 Like

finally with this build works good

http://builds.erikbryn.com/ember-model/ember-model-latest.js