Skip to content

Improper loading of ActionController::Base causes initialization conflicts #142

@ricksuggs

Description

@ricksuggs

Problem

The health_check gem causes ActionController::Base to be loaded too early in the Rails initialization process. This causes some initializers to be loaded after ActionController::Base is loaded, which in turn means that the configurations are not applied as expected.

For example, when a Rails app is upgraded from 6.1 to 7.0, a new_framework_defaults_7_0.rb is created to configure the new framework defaults for the new version one by one. (Source code)

One of these configurations is:

# Enable parameter wrapping for JSON.
# Previously this was set in an initializer. It's fine to keep using that initializer if you've customized it.
# To disable parameter wrapping entirely, set this config to `false`.
Rails.application.config.action_controller.wrap_parameters_by_default = true

If the health_check gem is included in the project, then setting this configuration to true has no effect.

This issue is describe in detail in this Github issue in the rails repo.

This section of the Rails documentation describes how to correctly load Rails modules in third party engines / libraries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions