Autoload plugins folder in Rails 3?
The methods in the last two rows in the block are removed in Rails 3.
%w{ models controllers }.each do |dir|
path = File.join(File.dirname(__FILE__), 'app', dir)
$LOAD_PATH << path
ActiveSupport::Dependencies.load path
ActiveSupport::Dependencies.load_once_paths.delete(path)
end
I wonder how you could autoload the files in the plugins models and controllers folder开发者_开发技巧?
load_paths
and load_once_paths
were renamed in Rails 3 :
ActiveSupport::Dependencies.autoload_paths
ActiveSupport::Dependencies.autoload_once_paths
精彩评论