Sha256: caacc8f6c3b37cf4758727b3e4bcfae7c3236042e473eb39fe46e1886efced32
Contents?: true
Size: 1.74 KB
Versions: 13
Compression:
Stored size: 1.74 KB
Contents
= Modules Modules are subapplications that are run as application plugins. They're used to define pieces of functionality that are pluggable to Decidim. Decidim's modules are no more than Ruby on Rails engines that should be required in the application's `Gemfile`. You can see some of our more popular modules at https://decidim.org/modules[Decidim's Modules]. == Types You can have multiple modules types: * For Spaces * For xref:develop:components.adoc[Components] * For Verifications == Example A typical engine looks like the following: [source,ruby] ---- module Decidim module Verifications module MyVerifier # This is an engine that authorizes users by doing a custom verification. class Engine < ::Rails::Engine isolate_namespace Decidim::Verifications::MyVerifier paths["db/migrate"] = nil paths["lib/tasks"] = nil routes do resource :authorizations, only: [:new, :create, :edit, :update], as: :authorization root to: "authorizations#new" end # This is a Dedicim::Verifications specific initializer initializer "decidim.my_verifier_verification_workflow" do |_app| Decidim::Verifications.register_workflow(:my_verifier) do |workflow| workflow.engine = Decidim::Verifications::MyVerifier::Engine end end # more initializers here... end end end end ---- It is a standard Ruby on Rails engine. == Decidim gotchas with engines If you have an external module that defines rake tasks and more than one engine, you probably want to add `paths["lib/tasks"]= nil` to all engines but the main one, otherwise the tasks you define are probably running multiple times unintentionally. Check #3892 for more details.
Version data entries
13 entries across 13 versions & 1 rubygems