Render Rails custom view from plugin


I’m working on a plugin that renders a Rails view on a specific path. I add the controller but when trying to render this specific controller action it says the view for the action doesn’t exist.

Debugging for a bit I found that the plugin views path is not available to Rails, only discourse/app/views and docker_manager/app/views.

I added this to the controller in order to add views to list of places where Rails will look

module DebtcollectiveSso
  class ApplicationController < ::ApplicationController
    before_action :prepend_plugin_view_path

    def prepend_plugin_view_path
      prepend_view_path(Rails.root.join('plugins', 'discourse-debtcollective-sso', 'app', 'views'))

I feel this shouldn’t be needed but I may be wrong. Is this the right approach or I’m doing something wrong?