# How to load a plugin on the run?

**URL:** <https://www.ruby-forum.com/t/how-to-load-a-plugin-on-the-run/112149>\
**Category:** Rails\
**Created:** [August 15, 2007, 10:52pm UTC](https://www.ruby-forum.com/t/how-to-load-a-plugin-on-the-run/112149 "2007-08-15T22:52:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [August 15, 2007, 10:52pm UTC](https://www.ruby-forum.com/t/how-to-load-a-plugin-on-the-run/112149/1 "2007-08-15T22:52:50Z")

</div>

Hey all,  
I have a multisite app and I want to load certain plugins for each of  
them. Is there a way to use a before\_filter that would load a given  
plugin by looking at the url? If so how?

thanx in advance

Pat

---

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [August 15, 2007, 11:16pm UTC](https://www.ruby-forum.com/t/how-to-load-a-plugin-on-the-run/112149/2 "2007-08-15T23:16:54Z")

</div>

On 8/15/07, Patrick A. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hey all,  
> I have a multisite app and I want to load certain plugins for each of  
> them. Is there a way to use a before\_filter that would load a given  
> plugin by looking at the url? If so how?

That won’t work because there’s no real way to unload a plugin for  
another app that doesn’t use it.

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [August 15, 2007, 11:18pm UTC](https://www.ruby-forum.com/t/how-to-load-a-plugin-on-the-run/112149/3 "2007-08-15T23:18:54Z")

</div>

On 8/15/07, Rick O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> That won’t work because there’s no real way to unload a plugin for  
> another app that doesn’t use it.

Ok thanx, is there a way then to load them all and ignore some of them  
for a given url?

---

<div class="post-metadata">

**Author:** ![patcito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/50afbb/32.png) [@patcito](https://www.ruby-forum.com/u/patcito)\
**Post date:** [August 16, 2007, 12:51pm UTC](https://www.ruby-forum.com/t/how-to-load-a-plugin-on-the-run/112149/4 "2007-08-16T12:51:46Z")

</div>

On Aug 15, 10:18 pm, “Patrick A.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 8/15/07, Rick O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > That won’t work because there’s no real way to unload a plugin for  
> > another app that doesn’t use it.
> 
> Ok thanx, is there a way then to load them all and ignore some of them  
> for a given url?

Plugins are loaded when the server starts, and cannot be unloaded or  
reloaded dynamically for each request.

I think your best bet will be to find another angle to approach your  
problem. It sounds like the different sites your current application  
runs have sufficiently-different behaviour that they may need to be  
different applications entirely…

–  
James
