Skip to content

plugin-hotspot: dinamic hotspot for models callbacks

Rodrigo Souto requested to merge diguliu/noosfero:dynamic-callbacks into master

With this, every model that includes Noosfero::Plugin::HotSpot will provide callbacks hotspots for plugins to answer. The current callbacks included are {after,before}_{create,destroy,save}.

So if a plugin wants to do something on a comment after_save, it should define a hotspot somewhat like this:

def comment_after_save_callback(comment) end

Obviously, the callback provides the object in context as parameter.

This will replace the problematic common practice of creating a lib/ext/my_model.rb and injecting the callbacks inside the class which bypass the enabled plugins logic.

Signed-off-by: Rodrigo Souto rodrigo@colivre.coop.br Signed-off-by: Marcos Ronaldo marcos.rpj2@gmail.com

Merge request reports