Adding a directory to the load path in Rails?

后端 未结 8 1035
囚心锁ツ
囚心锁ツ 2020-12-04 14:25

As of Rails 2.3, what\'s the right way to add a directory to the load path so that it hooks into Rails\' auto-reloading mechanisms?

The specific example I\'m thinkin

8条回答
  •  长情又很酷
    2020-12-04 14:41

    On Rails 5 you need to add the following code to environment.rb:

    # Add the widgets folder to the autoload path
    Rails.application.configure do
      config.autoload_paths << "#{Rails.root}/app/widgets"
    end
    

提交回复
热议问题