I’ve been playing around with Engines a bit at work, and I ran into an issue where I had to restart the server over and over due to class caching issues.
To make a long story short, I was able to force Rails to reload the particular engine I was using by adding the following to the engine’s init.rb:
%w(controllers helpers models views).each {|path| Dependencies.load_once_paths.delete File.join(File.dirname(__FILE__), 'app', path) }
Dependencies.load_once_paths.delete File.join(File.dirname(__FILE__), 'lib')
This worked with Rails 2.1 and an unknown version of the Engines plugin.
April 26th, 2011 at 9:09 am
Thank you very much!
I faced class cashing issue when tried to add my custom class to rails framework, then gave up and removed it, but still could initiate it! Thought that will drive me crazy, but now found you post.
Thanks!