-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move controller to app/controllers/health_check #110
base: master
Are you sure you want to change the base?
Conversation
The rails convention for a rails engine is to have the folder structure mimic a rails applications. With rails bringing in Zeitwerk this convention is being enforced. By not having the controller under app/controllers the controller (and so the constant ActionController::Base) is getting required during initialization. This is currently raising the deprecation warning: "Initialization autoloaded the constants ActionText::ContentHelper and ActionText::TagHelper. Being able to do this is deprecated. Autoloading during initialization is going to be an error condition in future versions of Rails." Moving the controller into app/controllers/health_check and removing the require allows rails to autoload the controller correctly and so silences this deprecation warning.
Can we get this merged? |
Minor change fixes deprecation warning. |
I'd like to test this a bit before accepting it. It's sat for a couple years now and Rails 7 introduced some changes to autoloading. |
@jmarchello Fair enough, I can only really confirm that it works in the Rails 6 application I work on. |
This change is also needed for Rails to use any Without this change, That is why the outcome of |
Bump... please? |
For what it's worth, we've been able to work around this issue by setting # config/initializers/health_check.rb
ActiveSupport.on_load(:action_controller) do
require 'health_check'
HealthCheck.setup do |config|
# ... configuration here ...
end
end |
Thanks for this information, very helpful!
…On Thu, 10 Aug 2023 at 13:29 Vesa Laakso ***@***.***> wrote:
For what it's worth, we've been able to work around this issue by setting gem
'health_check', require: false in Gemfile and loading the health_check
gem only after ActionController has been loaded via an initializer like
this:
# config/initializers/health_checkActiveSupport.on_load(:action_controller) do
require 'health_check'
HealthCheck.setup do |config|
# ... configuration here ...
endend
—
Reply to this email directly, view it on GitHub
<#110 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAABNDXIYSCTFH4VQHA6AITXUR5THANCNFSM46YOWNCA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
The rails convention for a rails engine is to have the folder structure mimic a rails applications. With rails bringing in Zeitwerk this convention is being enforced. By not having the controller under app/controllers the controller (and so the constant ActionController::Base) is getting required during initialization.
This is currently raising the deprecation warning:
"Initialization autoloaded the constants ActionText::ContentHelper and ActionText::TagHelper. Being able to do this is deprecated. Autoloading during initialization is going to be an error condition in future versions of Rails."
Moving the controller into app/controllers/health_check and removing the require allows rails to autoload the controller correctly and so silences this deprecation warning.