-
Notifications
You must be signed in to change notification settings - Fork 9
Creating plugins gems to extend Para
Valentin Ballestrino edited this page Nov 29, 2016
·
4 revisions
These are notes for a future wiki entry.
- Use the
para-gem_name
format - Make it a Rails engine (to Rails autoloading to work), without isolating the namespace
- Add a
#config
method to the base module (Para::GemName
) - Add a
Para::GemName::Routes
module to define pluggable routes - Add a
Para::GemName.config.javascript_includes
to include javascript assets to the baseadmin.js
file loaded by para - List hooks available
If your plugin needs to add routes to the app, you can create a Para::Plugins::Route
subclass and implement the draw
method.
To namespace the routes with your plugin's name, use the plugin
method to wrap your routes. Using plugin :my_gem
would scope controller lookup to the para/my_gem
namespace, which should be the default namespace for your code in a classical Para plugin.
module Para
module MyGem
class Routes < Para::Plugins::Routes
def draw
plugin :my_gem do
crud_component controller: :special_resources
end
end
end
end
end
Note : Do not forget to load the routes into your gem by autoloading or requiring the file at the top of your gem's namespace.