rying to create a conditional override for rails error output (suitable for certain situations where you would speed up feedback/review loop from a divided review group – one that should see error messages, and one that has no use for them)
Working with Rails 7.2.2.1
The global override “config.consider_all_requests_local” does work for me, in config/environments/development.rb - I can switch off the error messages in dev mode by setting that to “false”
But seeking granular, runtime control – googling suggests to define/override the
“def local_request?” method. Suggestions include adding the method to ActionController::Rescue
I have tried to do that in application.rb and under initializers/my_custom_inits.rb
Has no effect – rails is still honoring the “config.consider_all_requests_local = false” flag
I have tried the following in various startup scopes:
ActionController::Rescue.module_eval do
def local_request? true # set to true for testing (later have runtime conditionals) end
end
Not overriding the (overriding) config flag (essentially – seeking to override the override, conditionally)