Getting the module name with ObjectSpace...

Hey :slight_smile:

I'm trying to create a method for making a sitemap dynamically. It
works great for flat sites where you simply have your controllers in
the app/controllers directory. In this case, I can extract the
controller names like,

  @controllers
  ObjectSpace.subclasses_of(ActionController::Base).each do |obj|
      @controllers["#{obj.controller_name}"] = obj
  end

However, now I've divided the site into modules, that is, I have for
instance both Store::ItemsController and Manage::ItemsController,
which reside in app/controllers/store and app/controllers/manage
respectively.

This causes my code above to basically (as it seems) discard the
"duplicate" controllers when traversing the classes. What I'd like to
do is mimic the hierarchy in my module::controller::action structure,
but I don't know how to do that...

I'd like to have a three dimensional array like, [module_name]
[controller_name][action_name]

Help?

Thanks :slight_smile:

Daniel