I'm Using ember 1.13.8 and rails 4 in back-end. I'm having an 'item' model in my app. How can i force ember to reload items route which contains all the items collection after inserting an item record.Here are my route files for items and create:
app/routes/items/create.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(){
return this.store.createRecord('item');
},
actions: {
create: function(){
var self=this;
self.controller.get('model').save().then(
function() {
self.transitionTo('items');
});
}
}
});
app/routes/items.js
import Ember from 'ember';
export default Ember.Route.extend({
model: function(){
return this.store.findAll('item');
}
});
After inserting a record, i'm using transitionTo to go to the items route which does not automatically reloads the model, so how can i make ember to reload data from server.