Get an arbitrary collection from gems?

Hi,

I’m looking to do something though I’m not quite sure how to phrase
it. What I’m looking to do is, essentially, make custom hooks using
plugins/engines/gems.

My use case is a member dashboard:

I have a view partial for my site and a number of gems that I wrote
installed. Each gem correlates to something a member can manage, like
a photo gallery, their profile, their friends, etc.

Now, I know I could open up my view partial and code links to each one
of these things, eg:

Manage Photos

But, I was hoping for something slightly more modular, and was hoping
I could figure out some way to hook these links in dynamically when I
install my gem and or run my generators.

In other CMS’ I have used, this was possible. Wordpress for example
had a hook, and Magento had an XML based admin navigation when the
links to manage your account were dynamically populated.

What would be a way to go about this in Rails? I’ve thought of making
a db table and writing to it with seeds when I run each gem’s
generators. But I was hoping something simpler. Is there some way I
could essentially get a collection from my gems’ lib files?

W/ the help of someone in IRC (), i did it like this…

I put this in my main Gem
module DevapeMemberNavigation
mattr_accessor :items
self.items = []
module Hooks
def register_navigation_item(item)
DevapeMemberNavigation.items << item
end
end
end

module DevapeCms
extend DevapeMemberNavigation::Hooks
end

DevapeCms.register_navigation_item(’/member/posts’)

In another Gem, I wrote
require “devape_cms”

module DevapeSurvey
extend DevapeMemberNavigation::Hooks
end

DevapeSurvey.register_navigation_item(’/member/surveys’)

Then, in my main app, this will return the desired array <%=
DevapeMemberNavigation.items %>