Plugins power MongoMapper from the ground up. Every piece of functionality is a plugin, making MongoMapper easily extendable. If you need some crazy functionality, just build it.
A plugin, in MongoMapper terms, is simply a module that extends ActiveSupport::Concern
.
Once you have your plugin defined, you can use it by calling the plugin
method in your model:
If you would like to use a plugin in all documents or embedded documents, call plugin
on the Document
or EmbeddedDocument
module: