Rails3 not reloading code in lib while in development mode

后端 未结 4 1014
暖寄归人
暖寄归人 2020-12-13 07:35

THE SITUATION:

  1. I have code in lib/foo/bar.rb with a simple method defined as such:

    module Foo
      class Bar
                 
    
    
            
4条回答
  •  醉话见心
    2020-12-13 08:17

    Why are you putting the require into the module, when using autoload_path you should not need to require the file at all, it should be working without, I think if you manually require the file afterwards, rails does not know when to load it again?

    Something like this:

    require `bar`
    
    module FooBarHelper
    
      def test_foo_bar
        fb = Foo::Bar.new
        fb.test
      end
    
    end
    

    should work, no need for having the require inside your module.

提交回复
热议问题