Forum: Rails Engines development Making Rails 2.0 reload engine controllers and models

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
mateo murphy (Guest)
on 2008-02-19 21:26
(Received via mailing list)

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 = {
|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 = { |path| (path =~
/#{name}\/app/).nil? }

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?

This topic is locked and can not be replied to.