# Plugins within plugins

**URL:** <https://www.ruby-forum.com/t/plugins-within-plugins/184751>\
**Category:** Rails\
**Created:** [March 8, 2010, 1:34am UTC](https://www.ruby-forum.com/t/plugins-within-plugins/184751 "2010-03-08T01:34:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tristan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tristan](https://www.ruby-forum.com/u/tristan)\
**Post date:** [March 8, 2010, 1:34am UTC](https://www.ruby-forum.com/t/plugins-within-plugins/184751/1 "2010-03-08T01:34:20Z")

</div>

Hi all

I have a plugin which itself needs to load some plugins from its own  
vendor/plugins directory.

I’ve spent half of this morning Googling about for answers but I  
haven’t found anything suitable yet.

I’ve been looking at adding plugin load paths to the host app’s  
initializer object from init.rb but, of course, that’ll be useless  
seeing as being in init.rb means that the plugin loader is already  
running.

Does anyone know of a solution that can be incorporated into a  
plugin’s init.rb file that’ll load these “nested” plugins alongside  
the host app’s plugins? Or is there another Rails “best practice”  
approach that I haven’t found yet?

Any help greatly appreciated.

Thanks  
Tristan

---

<div class="post-metadata">

**Author:** ![tristan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tristan](https://www.ruby-forum.com/u/tristan)\
**Post date:** [March 8, 2010, 2:29am UTC](https://www.ruby-forum.com/t/plugins-within-plugins/184751/2 "2010-03-08T02:29:56Z")

</div>

What if you simply add the additional plugins to your main  
application?  
At least this is what I’m doing… I have 30+ engine plugins which  
partly depend on each other. So we add whatever is required to the  
main application. For testing each engine plugin still has to  
reference all needed plugins but this is a different topic.

Daniel

---

<div class="post-metadata">

**Author:** ![tristan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tristan](https://www.ruby-forum.com/u/tristan)\
**Post date:** [March 8, 2010, 3:45am UTC](https://www.ruby-forum.com/t/plugins-within-plugins/184751/3 "2010-03-08T03:45:26Z")

</div>

I don’t have too many plugins so this is still an option. However, I’m  
eventually going to roll this plugin into a gem and I want to deploy  
it using a config.gem dependency. Having all the dependencies self-  
contained would be a huge bonus when it comes to keeping all my apps  
up to date as I can simply update the version of the gem being used.

---

<div class="post-metadata">

**Author:** ![tristan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/96bed5/32.png) [@tristan](https://www.ruby-forum.com/u/tristan)\
**Post date:** [March 8, 2010, 5:38am UTC](https://www.ruby-forum.com/t/plugins-within-plugins/184751/4 "2010-03-08T05:38:25Z")

</div>

If I’m not completely mistaken, using “bundler” should solve your  
problem. You can define dependencies within you gem and bundler will  
resolve the dependencies for you and install what is needed. This is  
at least a possibility I wanted to invest for my setup once moved over  
to Rails 3
