I'm trying to work through deprecations messages in Ember 1.11 about object proxying in templates, and have run into confusion.
On an edit route, for example, I was loading a single record in the model hook. Then, using the setupController hoook, I was setting other collection variables to enable select menus. This provoked deprecation notices about proxying; I attempted to resolve those by setting all data in the model hook using an Ember.RSVP.hash as the model.
I now have a problem where, if I load the page directly, the model is correct, but if I visit from a link-to, the model is incorrect. I found information on similar problems that led me to try using setupController to set the model, based on this.get('model'), hoping that would grab the model from the route's model funtion, but this also did not work. The setupController action is being invoked, but it doesn't seem to be affecting the template for some reason, which is where I've had a roadblock.
show.hbs:
{{link-to model}}
edit.hbs –– data present if direct page load, empty if visiting from show link-to
{{model.foo.name}}
edit route:
renderTemplate: function (controller,model) {
this.render('foo/form');
},
model: function (project) {
return Ember.RSVP.hash({
foo: this.store.find("foo", foo.foo_id),
bar: this.store.find('bar')
});
}
also tried this for edit route:
renderTemplate: function (controller,model) {
this.render('foo/form');
},
model: function (project) {
return Ember.RSVP.hash({
foo: this.store.find("foo", foo.foo_id),
bar: this.store.find('bar')
});
},
setupController: function (controller, model) {
controller.set('model', this.get('model');
}