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


#1

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: https://www.dropbox.com/s/v3pcxgyy1rxcgm8/Selection_001.jpg


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

#3

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;

#4

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


#5

finally with this build works good

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