Adding a directory to the load path in Rails?

后端 未结 8 1036
囚心锁ツ
囚心锁ツ 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:45

    Another update for rails 3 -- activesupport 3.0.0:

    Instead of:

    ActiveSupport::Dependencies.load_paths << "#{RAILS_ROOT}/app/widgets"
    

    You may need to do this:

    ActiveSupport::Dependencies.autoload_paths << "#{RAILS_ROOT}/app/widgets"
    

提交回复
热议问题