Hi! I have rails application. Now I want add there some modules. I try to do it using plugins and have a problem. Maybe I doing something wrong.
I build module as a class. Each module has own class definition with necessary functionality. Now I want to access them (get list of modules for example). How should I access them?
I tried to declare a registry class in /lib and build a list of modules them (list is filled in init.rb of each module). Then I create a page where list of modules would be shown.
And now I have a problem. In first access page displays everything ok. But next access displays an empty page!
My "module registry" looks like
private_class_method :new
def self.instance @mod = new unless @mod @mod end
def register_module (mod) @modules = if !@modules @modules << mod end
def modules @modules = if !@modules @modules end
What am I doing wrong? Do you have links to articles about organization architecture like this?