How to Modify Ember Route Class

Hello All,
I want to modify the Ember Route class (/app/assets/javascripts/discourse/routes/tags-show.js.es6) in the same way that we modify Controller and Component classes using pluginAPI.
An example that we modify composer.js.es6 controller as below:

<script type="text/discourse-plugin" version="0.8">
  api.modifyClass('controller:composer', {
    actions: {
        newActionHere() { }

Is it possible to modify the Ember Route class in the same way?

I believe this is possible — I think it works via route:route-name. Have you given it a try?

route:route-name working but when I try to override action createTopic as shown below:

<script type="text/discourse-plugin" version="0.8">
  api.modifyClass('route:tags-show', {
    actions: {
     createTopic() {
      const controller = this.controllerFor("");

      if (controller.get("list.draft")) {
      } else {
            categoryId: controller.get(""),
            action: Composer.CREATE_TOPIC,
            draftKey: controller.get("list.draft_key"),
            draftSequence: controller.get("list.draft_sequence")
          .then(() => {
            // Pre-fill the tags input field
            if (controller.get("")) {
              const composerModel = this.controllerFor("composer").get("model");


It throws Error :
ReferenceError: Composer is not defined

This happens because Composer is not defined in your code. If you look at the tags-show route, you’ll see that Composer is defined at the top.

However, since you’re doing this in theme script tags, you can’t use import. You’ll have to use require instead.

So, it should work if you add something like this to the top of your code

const Composer = require("discourse/models/composer");

That said, I strongly recommend that you spend a bit of time reading

and experimenting with this new way of creating themes. It’s much easier to follow examples in core that way.