Best way to load module/class from lib folder in Rails 3?

后端 未结 12 2002
别跟我提以往
别跟我提以往 2020-11-22 11:56

Since the latest Rails 3 release is not auto-loading modules and classes from lib anymore, what would be the best way to load them?

From github:

12条回答
  •  天命终不由人
    2020-11-22 12:19

    config.autoload_paths does not work for me. I solve it in other way

    Ruby on rails 3 do not automatic reload (autoload) code from /lib folder. I solve it by putting inside ApplicationController

    Dir["lib/**/*.rb"].each do |path|
      require_dependency path
    end 
    

提交回复
热议问题