In my router file, I have something like this:
this.resource('project', { path: 'project/:project_id' }, function() {
this.route('edit');
});
I have a link to a project in a template that looks like this:
{{#link-to 'project.edit' project}}edit{{/link-to}}
My edit project route looks like:
import Ember from 'ember';
export default Ember.Route.extend({
model: function(params) {
return this.store.findRecord('project', params.project_id);
}
});
When I click the edit link for a project and navigate to the edit page, the page renders as expected. However, when I navigate back to the projects index view, there is now an additional phantom object added to the list. A new phantom object gets created every time I hit the edit page for a project.
If I don’t nest the edit route under the project resource, no phantom object is created. Obviously, something about this nesting is causing the auto-creation of a new object. But, it’s unclear to me where this is happening. Does anyone know what I am doing wrong?