Rails 4 uninitialized constant for module

前端 未结 4 1987
不思量自难忘°
不思量自难忘° 2020-12-13 13:33

In a new rails 4 app I anm getting an unintialized constant error for a module. The module is named ProcessBill and is located in lib/process_bill.rb

console error:<

4条回答
  •  误落风尘
    2020-12-13 14:07

    I had this problem too with the lib directory with Rails 5 and it appeared in production but not in development. To fix it you need to add the lib directory to eager_load_paths. Here is the relevant part from my application.rb:

    config.autoload_paths << "#{Rails.root}/lib"
    config.eager_load_paths << "#{Rails.root}/lib"
    

提交回复
热议问题