File tree 4 files changed +37
-1
lines changed
app/controllers/my_plugin_module
4 files changed +37
-1
lines changed Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ module ::MyPluginModule
4
+ class ExamplesController < ::ApplicationController
5
+ requires_plugin PLUGIN_NAME
6
+
7
+ def index
8
+ render json : { hello : "world" }
9
+ end
10
+ end
11
+ end
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ MyPluginModule ::Engine . routes . draw do
4
+ get "/examples" => "examples#index"
5
+ # define routes here
6
+ end
7
+
8
+ Discourse ::Application . routes . draw { mount ::MyPluginModule ::Engine , at : "my-plugin" }
Original file line number Diff line number Diff line change
1
+ # frozen_string_literal: true
2
+
3
+ module ::MyPluginModule
4
+ class Engine < ::Rails ::Engine
5
+ engine_name PLUGIN_NAME
6
+ isolate_namespace MyPluginModule
7
+ config . autoload_paths << File . join ( config . root , "lib" )
8
+ end
9
+ end
Original file line number Diff line number Diff line change 9
9
10
10
enabled_site_setting :plugin_name_enabled
11
11
12
- after_initialize { }
12
+ module ::MyPluginModule
13
+ PLUGIN_NAME = "discourse-plugin-name"
14
+ end
15
+
16
+ require_relative "lib/my_plugin_module/engine"
17
+
18
+ after_initialize do
19
+ # Code which should run after Rails has finished booting
20
+ end
You can’t perform that action at this time.
0 commit comments