Skip to content

Fix autoload for license_request.rb

Thong Kuah requested to merge fix_admin_license_request_autoload into master

What does this MR do?

Fixes uninitialized constant Admin::LicenseRequest in development environment when navigating to http://localhost:3000/admin/license

It is not in the usual autoload_paths, so move it to a more conventional path which also autoloads

Before with Rails console :

$ be rails c
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
 GitLab:       13.9.0-pre (75f114e374b) EE
 GitLab Shell: 13.15.0
 PostgreSQL:   11.9
--------------------------------------------------------------------------------

Admin::LicenseRequest

Loading development environment (Rails 6.0.3.4)
[1] pry(main)> 
[2] pry(main)> Admin::LicenseRequest
NameError: uninitialized constant Admin::LicenseRequest
from /Users/tkuah/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `block in load_missing_constant'
Caused by NameError: uninitialized constant Admin::LicenseRequest
from /Users/tkuah/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/active_support.rb:61:in `block in load_missing_constant'
[3] pry(main)> 

After:

$ be rails c
--------------------------------------------------------------------------------
 Ruby:         ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
 GitLab:       13.9.0-pre (75f114e374b) EE
 GitLab Shell: 13.15.0
 PostgreSQL:   11.9
--------------------------------------------------------------------------------
Loading development environment (Rails 6.0.3.4)
[1] pry(main)> Admin::LicenseRequest
=> Admin::LicenseRequest
Edited by Thong Kuah

Merge request reports

Loading