mirror of
https://github.com/discourse/discourse-rewind.git
synced 2025-07-07 06:12:22 +00:00
DEV: Add rails engine and file paths to skeleton (#29)
This commit is contained in:
parent
f19d9a8aa6
commit
8421cf6d72
11
app/controllers/my_plugin_module/examples_controller.rb
Normal file
11
app/controllers/my_plugin_module/examples_controller.rb
Normal file
@ -0,0 +1,11 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ::MyPluginModule
|
||||
class ExamplesController < ::ApplicationController
|
||||
requires_plugin PLUGIN_NAME
|
||||
|
||||
def index
|
||||
render json: { hello: "world" }
|
||||
end
|
||||
end
|
||||
end
|
8
config/routes.rb
Normal file
8
config/routes.rb
Normal file
@ -0,0 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
MyPluginModule::Engine.routes.draw do
|
||||
get "/examples" => "examples#index"
|
||||
# define routes here
|
||||
end
|
||||
|
||||
Discourse::Application.routes.draw { mount ::MyPluginModule::Engine, at: "my-plugin" }
|
9
lib/my_plugin_module/engine.rb
Normal file
9
lib/my_plugin_module/engine.rb
Normal file
@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ::MyPluginModule
|
||||
class Engine < ::Rails::Engine
|
||||
engine_name PLUGIN_NAME
|
||||
isolate_namespace MyPluginModule
|
||||
config.autoload_paths << File.join(config.root, "lib")
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user