Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ActiveSupportConcern recursively checks for
ClassMethod
Problem ------- `ActiveSupportConcern` uses [const_defined?](https://apidock.com/ruby/Module/const_defined%3f) to check if `ClassMethods` exists on a module. By default, `const_defined?` checks the module and its ancestors for the existence of the constant. This means that `const_defined?` will return `true` when a module does not have `ClassMethods` defined, but one of its ancestors does. This can result in `ActiveSupportConcern` generating `mixes_in_class_methods.*ClassMethods` lines for invalid `.*ClassMethods` modules. The first commit in this PR adds a negative test case that should fail with the existing code. Solution -------- `const_defined?` takes a second parameter that controls whether to include ancestors in the check. Setting this parameter to `false` to exclude ancestors.
- Loading branch information