更新时间:2022-12-17 16:01:27
对于Rails 3,将文章中给出的说明与@science 的答案不同.在您的 environments/development.rb
文件中,添加以下行:
For Rails 3, vary the instructions given in the article from @science's answer. In your environments/development.rb
file, add the lines:
ActiveSupport::Dependencies.autoload_paths << File::join( Rails.root, 'lib')
ActiveSupport::Dependencies.explicitly_unloadable_constants << 'MyModuleInLibFolder'
当然,用您的模块名称替换 MyModuleInLibFolder
.
Of course, substitute the name of your module for MyModuleInLibFolder
.