# Routing Error uninitialized constant TestController

**URL:** <https://meta.discourse.org/t/routing-error-uninitialized-constant-testcontroller/60294>\
**Category:** Development\
**Created:** [April 1, 2017, 6:30pm UTC](https://meta.discourse.org/t/routing-error-uninitialized-constant-testcontroller/60294 "2017-04-01T18:30:23Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![Sudaraka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sudaraka/32/68401_2.png) [@Sudaraka](https://meta.discourse.org/u/Sudaraka)\
**Post date:** [April 1, 2017, 6:30pm UTC](https://meta.discourse.org/t/routing-error-uninitialized-constant-testcontroller/60294/1 "2017-04-01T18:30:23Z")

</div>

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.

---

_[View the full topic](https://meta.discourse.org/t/routing-error-uninitialized-constant-testcontroller/60294)._
