Controller needs parent


#1

I have routes setup like this:

Router.map(function() {
  this.resource("post", function() {
    this.resource("icons", function() {
    });
  });

  this.resource("comment", function() {
    this.resource("icons", function() {
    });
  });
});

The idea is for both “post” and “comment” to share the same icons route, controller, view, and template.

Now in the icons controller, I need to “needs” the parent controller, which is going to be either the “post” controller or the “comment” controller. Preferably I could need the “parent” controller, but that isn’t supported. How should I proceed?

At one point I had everything duplicated and set my icons to “post.icons” and “comment.icons” but it felt like I was needlessly over complicating things.