My subject is probably not the best description, so here is an example of what I am trying to do. class ExampleController < ApplicationController include EventManager def action @name = ''John'' event(:event, :context) do @name << '' Doe'' end end end module EventManager def event(*args) # Retrieve the module based on the parameters. # Call EventManager::Event::Context.before if it exists with access to the variables from where event was called. yield if block_given? # Call EventManager::Event::Context.after if it exists with access to the variables from where event was called. end module Event module Context def before puts "Hi John" if @name == ''John'' end def after puts "Who?" if @name != ''John'' end end end end Basically I want to be able to store methods in nested modules for separation, but be able to call them dynamically within controller actions via the event method. My current solutions involves module_function for all the before and after methods and retrieving controller information by passing the controller to each action and using send and instance_variable_get/set which is less than ideal in my opinion. Any suggestions, or hints? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---