开发者

Autoload plugins folder in Rails 3?

开发者 https://www.devze.com 2023-01-11 01:58 出处:网络
The methods in the last two rows in the block are removed in Rails 3. %w{ models controllers }.each do |dir|

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
0

精彩评论

暂无评论...
验证码 换一张
取 消