Hi i wrote a simple plugin just for education purpose. I need to get a json by calling http://localhost:4000/admin/plugins/test/list
url. I wrote the plugin.rb as
# name: test-plugin
# about: This is intended to be a test
# version: 1.0.0
# authors: Test_Author
after_initialize do
module ::Test
class Engine < ::Rails::Engine
engine_name 'test'
isolate_namespace Test
end
end
require_dependency 'application_controller'
class ::Test::TestController < ::ApplicationController
#This class will contain all the back end controller methods
requires_plugin 'test-plugin'
require_dependency 'admin_constraint'
#this will return the JSON of users in the plugin store
def list
render json: { name: "donut", description: "delicious!" }
end
end
Test::Engine.routes.draw do
get "/list" => "test#list", constraints: AdminConstraint.new
end
Discourse::Application.routes.prepend do
mount ::Test::Engine, at: "/test"
end
add_admin_route "test.title", "test"
Discourse::Application.routes.append do
get "/admin/plugins/test" => "admin/plugins#index"
get "/admin/plugins/test/list" => "test#list"
end
end
But when i call the url , it always return
Routing Error
uninitialized constant TestController
Rails.root: /vagrant
Application Trace | Framework Trace | Full Trace
config/initializers/100-quiet_logger.rb:17:in `call_with_quiet_assets'
config/initializers/100-silence_logger.rb:29:in `call'
lib/middleware/missing_avatars.rb:21:in `call'
lib/middleware/turbo_dev.rb:33:in `call'
can someone please help. Iām just a newbie here.