# Plugin Architecture

**URL:** <https://www.ruby-forum.com/t/plugin-architecture/188869>\
**Category:** Rails\
**Created:** [May 19, 2010, 5:02pm UTC](https://www.ruby-forum.com/t/plugin-architecture/188869 "2010-05-19T17:02:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [May 19, 2010, 5:02pm UTC](https://www.ruby-forum.com/t/plugin-architecture/188869/1 "2010-05-19T17:02:45Z")

</div>

Does anyone have any suggestions about building a plugin architecture  
for a  
Rails application?

This would be different from the Rails plugin architecture; this would  
be  
plugins for my Rails application in particular (i.e. like Firefox  
extensions, or OpenOffice extensions)

–

* * *

Joshua S. Martin

---

<div class="post-metadata">

**Author:** ![josh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/45deac/32.png) [@josh](https://www.ruby-forum.com/u/josh)\
**Post date:** [May 21, 2010, 5:00am UTC](https://www.ruby-forum.com/t/plugin-architecture/188869/2 "2010-05-21T05:00:37Z")

</div>

You can do most things with the plugin/gem architecture build into  
Rails. The only thing I have found is that initialization order and  
load\_path precedence may be different than normal plugins.

With the normal system the applicaiton’s views take precedence over  
views in an engine plugin or gem. With an application plugin system  
(I call mine “add-ons” to differentiate it from the Rails system), you  
may want to reverse this.

Right now I’ve just built my first “add-on” to the Kete app:

> **[GitHub - kete/kete\_translatable\_content: An add-on to the Kete application to...](https://github.com/kete/kete_translatable_content/)**
>
> An add-on to the Kete application to provide content translations. Relies on the mongo\_translatable gem. - GitHub - kete/kete\_translatable\_content: An add-on to the Kete application to provide cont...

The rails/init.rb file is where most of the example code you may want  
is. Notice that I add to a set of extensions blocks to run from  
within the Kete application after the initialization process has  
completed to reopen classes to extend their functionality (other  
classes are simply reopened in the config.to\_prepare block). This  
ties in on line 108 of the application’s environment.rb file:

[http://github.com/kete/kete/blob/enhancement\_269\_refactoring\_for\_adds\_on/config/environment.rb](http://github.com/kete/kete/blob/enhancement_269_refactoring_for_adds_on/config/environment.rb)

Hope this helps,  
Walter
