When and where do I require files in a rails application?

前端 未结 5 1690
半阙折子戏
半阙折子戏 2021-02-03 22:00

Let\'s say I have I have the following file in my lib directory of my rails application:

#lib/proxy.rb
module SomeService
  class ServiceProxy
    def do_somethi         


        
5条回答
  •  眼角桃花
    2021-02-03 22:43

    This is a helpful post about this issue.

    In short, Rails autoloads classes in your lib directory only if they follow the proper naming conventions.

提交回复
热议问题