Search code examples
ruby-on-railsrubyredmine

uninitialized constant occured when patch to Redmine


I patch to my Redmine(Ver4.0.0) for this patch file.

then, executed

bundle
bundle exec rake db:migrate RAILS_ENV=production

and restarted redmine.

But following error occurred when I attached file to ticket.

[ActiveJob] [ExtractFulltextJob] [3daafa4a-4d90-43ce-a065-c4257176ca0f] Error performing ExtractFulltextJob (Job ID: 3daafa4a-4d90-43ce-a065-c4257176ca0f) from Async(text_extraction) in 9.77ms: NameError (uninitialized constant Redmine::TextExtractor):
/home/redmine/redmine/app/jobs/extract_fulltext_job.rb:7:in `perform'

I checked redmine/config/application.rb

config.autoload_paths += %W(#{config.root}/lib)

and redmine/lib/redmine/text_extractor.rb

module Redmine
  class TextExtractor
  ....

But I could not understand why uninitialized constant error occured.

How to patch this ?


Solution

  • In rails5, production environment is not autoloaded by default. So, I add config.enable_dependency_loading = true then works fine.