Application plugin architecture

I am interested in adding a plugin architecture to the rails app I am
writing, and I was wondering if anyone had any good ideas of how to
implement this, or pointers to projects that have already done this.
“plugin” is obviously a popular word in the rails community, so
searching isn’t much help.

The basic requirements are that the app plugins should be able to
extend functionality (like add behavior or state) and modify the user
interface. The first one is obviously simple in rails, but I want to
be able to do it in a “safe” way, so that plugins can’t clobber each
other.

In statically typed languages, you would just implement this by
creating an interface, registering plugins that implemented that
interface, and calling those plugins at specific extension points.
Would this be the best approach in rails? I’m interested to hear if
anyone has any thoughts or examples.

Thanks,
Brandon