Extending nested resource routes

I’m trying to learn Ember as I build for Discourse so forgive me if this is simple. I’m attempting to add a route underneath the userActivity resource. If I understand correctly, I should be able to do something along these lines:

export default {
  resource: 'user.userActivity',
  map() {
    this.route('votes');
  }
};

But that doesn’t do it. I’ve read through these two topics:

https://meta.discourse.org/t/add-custom-route-from-initializer/36859

For those that run into this issue, here’s what I found that seems to work:

export default {
  resource: 'user',
  path: 'users/:username',
  map() {
    this.resource('userActivity', {path: 'activity'}, function(){
      this.route('votes')
    })
  }
};
6 Likes