Skip to content

Instantly share code, notes, and snippets.

@darklow
Last active December 22, 2015 07:38
Show Gist options
  • Save darklow/6438877 to your computer and use it in GitHub Desktop.
Save darklow/6438877 to your computer and use it in GitHub Desktop.
// in older versions, for getting model from different controller i was using:
App.FoodController = Em.ArrayController.extend({
addFood: function (food) {
var items = this.controllerFor('table').get('model').get('tab.tabItems');
tabItems.createRecord({
food: food
})
}
});
// in RC2
App.TableRoute = Ember.Route.extend({
setupController: function(model) {
this.controllerFor('tables').set('selectedTable', model);
}
});
App.FoodController = Ember.ArrayController.extend({
needs: ['tables'],
tableBinding: 'controllers.tables.selectedTable',
addFood: function(food) {
var tabItems = this.get('table.tab.tabItems');
tabItems.createRecord({
food: food
});
}
});
// Anyone can help to understand how to fix this so that it works in latest
// ember-js and ember-data? - How to access selectedTable.tab.tabItems and createRecrord
// Thank you
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment