# Making Rails 2.0 reload engine controllers and models

**URL:** <https://www.ruby-forum.com/t/making-rails-2-0-reload-engine-controllers-and-models/129584>\
**Category:** Engines Development\
**Created:** [February 19, 2008, 9:26pm UTC](https://www.ruby-forum.com/t/making-rails-2-0-reload-engine-controllers-and-models/129584 "2008-02-19T21:26:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mateo\_murphy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ec9cab/32.png) [@mateo\_murphy](https://www.ruby-forum.com/u/mateo_murphy)\
**Post date:** [February 19, 2008, 9:26pm UTC](https://www.ruby-forum.com/t/making-rails-2-0-reload-engine-controllers-and-models/129584/1 "2008-02-19T21:26:43Z")

</div>

Hello,

I’ve been working on a solution for making rails reload engine  
controllers and models. Initially, after a fair amount of googling, I  
came up with the following, in development.rb:

config.after\_initialize {  
Dependencies.load\_once\_paths = Dependencies.load\_once\_paths.select {  
|path| (path =~ /app/).nil? }  
}

While this solves the problem, I figured it would be even better to do  
it within the engines, which lead to this dirty hack:

in engines/lib/engines/plugin.rb, I added the following at the end of  
the load method:

```
  if ::RAILS_ENV == 'development'
    Dependencies.load_once_paths =

```

Dependencies.load\_once\_paths.select { |path| (path =~  
/#{name}/app/).nil? }  
end

A possibly cleaner approach would be to monkeypatch the  
add\_plugin\_load\_paths method in rail’s plugin loader, but it would  
just be more code for the same effect.

Any thoughts?

mateo
