From d6d1d3e1bdb999ceb8fbc057e8f66e6bd0718532 Mon Sep 17 00:00:00 2001 From: Zach Huntington-Meath Date: Fri, 31 Jul 2026 12:49:35 -0400 Subject: [PATCH] Fix Ruby 3.3 constant lookup in engine.rb On Ruby 3.3, constant lookup inside nested blocks no longer falls through to top-level scope. Qualify HostStatus, Host::Managed, and Hostgroup with :: to ensure they resolve correctly. --- lib/foreman_monitoring/engine.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/foreman_monitoring/engine.rb b/lib/foreman_monitoring/engine.rb index 0eab4c6..eca1e82 100644 --- a/lib/foreman_monitoring/engine.rb +++ b/lib/foreman_monitoring/engine.rb @@ -62,7 +62,7 @@ class Engine < ::Rails::Engine role 'Monitoring viewer', [:view_monitoring_results], 'Role granting permissions to view monitor results' role 'Monitoring manager', [:view_monitoring_results, :manage_downtime_hosts], 'Role granting permissions to view monitor results and manage downtimes' - register_custom_status HostStatus::MonitoringStatus + register_custom_status ::HostStatus::MonitoringStatus add_controller_action_scope('HostsController', :index) { |base_scope| base_scope.includes(:monitoring_results) } @@ -74,8 +74,8 @@ class Engine < ::Rails::Engine } # add monitoring smart proxy to hosts and hostgroups - smart_proxy_for Host::Managed, :monitoring_proxy, monitoring_proxy_options - smart_proxy_for Hostgroup, :monitoring_proxy, monitoring_proxy_options + smart_proxy_for ::Host::Managed, :monitoring_proxy, monitoring_proxy_options + smart_proxy_for ::Hostgroup, :monitoring_proxy, monitoring_proxy_options add_controller_action_scope('HostsController', :index) { |base_scope| base_scope.includes(:monitoring_proxy) }