« return

Rails 3 reload plugin or engine in development

04-Oct-2010, Ant

If you have a plugin or engine that you would like to reload on each page call in development mode.

In rails 2 this was done by:
if RAILS_ENV == 'development'
  ActiveSupport::Dependencies.load_once_paths.reject!{|x| x =~
                                      /^#{Regexp.escape(File.dirname(__FILE__))}/}
end

In rails 3 use:

if RAILS_ENV == 'development'
  ActiveSupport::Dependencies.autoload_once_paths.reject!{|x| x =~
                                       /^#{Regexp.escape(File.dirname(__FILE__))}/}
end