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

后端 未结 12 1744
别跟我提以往
别跟我提以往 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:20

    If only certain files need access to the modules in lib, just add a require statement to the files that need it. For example, if one model needs to access one module, add:

    require 'mymodule'
    

    at the top of the model.rb file.

提交回复
热议问题