# Making plugins reloadable

**URL:** <https://www.ruby-forum.com/t/making-plugins-reloadable/138795>\
**Category:** Rails\
**Created:** [May 27, 2008, 9:10pm UTC](https://www.ruby-forum.com/t/making-plugins-reloadable/138795 "2008-05-27T21:10:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [May 27, 2008, 9:10pm UTC](https://www.ruby-forum.com/t/making-plugins-reloadable/138795/1 "2008-05-27T21:10:48Z")

</div>

So is there a complete example anywhere of the best way to make  
plugins reloadable? Specifically we have a number of models in our  
plugins that need to be reloaded on each request in development. I do  
not want to use generators.

I’ve seen references to using config.to\_prepare like this:

config.to\_prepare { require\_dependency ‘foo’ }

What I don’t know is how to use this when we have 10 different  
plugins, each with 3-4 models. Do I have to hardcode all those models  
in custom code that I load in /lib, or is there a way to access config  
from a plugin’s init.rb?

Chris

---

<div class="post-metadata">

**Author:** ![snacktime](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/7feea3/32.png) [@snacktime](https://www.ruby-forum.com/u/snacktime)\
**Post date:** [May 27, 2008, 9:41pm UTC](https://www.ruby-forum.com/t/making-plugins-reloadable/138795/2 "2008-05-27T21:41:40Z")

</div>

On May 27, 8:10 pm, snacktime [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> So is there a complete example anywhere of the best way to make  
> plugins reloadable? Specifically we have a number of models in our  
> plugins that need to be reloaded on each request in development. I do  
> not want to use generators.

I just remove the plugin’s lib folder from  
Dependencies.load\_once\_paths (in the plugin’s init.rb)

Fred
