I am refactoring a simple CMS, and looking to implement a simple
internal plugin architecture.
I have a MenuItem class. By default, menu items can be, say, 'article'
or 'sitemap', or 'newsroll'. I want to implement a hook to which my
modules can plug, so I will be able to add other tipologies (like
"catalog", "gallery" or whatever) through modules, which are aptly
Presently, I have something like this:
[code=]class MenuItem < ActiveRecord::Base
@tipologies = Array.new
I have been able to add an item to @typologies through a plugin, with
[code=]ActionController::Base.send :include, Tipeadder[/code]
And this is the main plugin code (obviously I am just sketching here):
Yet the type is added only when the app is first loaded, then it gets
I am a also bit lost here. I have been using plugin architectures for
ages in Wordpress development, but never implemented one, so i am not
sure I am going the right way.
Have you go some general advice on the procedure I should follow? Which
is the best and most ruby-like way to do this?