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

前端 未结 5 1617
半阙折子戏
半阙折子戏 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:37

    Also note that some environment.rb's come with these comments:

    Rails::Initializer.run do |config|
      # Add additional load paths for your own custom dirs
      # config.load_paths += %W( #{RAILS_ROOT}/extras )
      config.load_paths << "#{RAILS_ROOT}/app/models/some_model_group"
      config.load_paths << "#{RAILS_ROOT}/lib"
    end
    

提交回复
热议问题