Skip to content

Cleanup Active Support core extensions#1757

Merged
neilvcarvalho merged 1 commit intomainfrom
nc-remove-monkey-patches-spike
Jul 18, 2025
Merged

Cleanup Active Support core extensions#1757
neilvcarvalho merged 1 commit intomainfrom
nc-remove-monkey-patches-spike

Conversation

@neilvcarvalho
Copy link
Member

@neilvcarvalho neilvcarvalho commented Jul 18, 2025

Reviewing the Active Support usage, I noticed two require calls that are unnecessary:

We don't use the Hash#except! method defined on active_support/core_ext/hash/except.rb, nor the Hash#with_indifferent_access defined on active_support/hash_with_indifferent_access.rb.

We do use the HashWithIndifferentAccess class directly, so we're now requiring "active_support/hash_with_indifferent_access" instead.

@neilvcarvalho neilvcarvalho marked this pull request as ready for review July 18, 2025 16:47
@neilvcarvalho neilvcarvalho marked this pull request as draft July 18, 2025 16:47
We're not using the `Hash#except!` method defined on
`active_support/core_ext/hash/except.rb`, nor are using
`Hash#with_indifferent_access` defined on
`active_support/hash_with_indifferent_access.rb`.
@neilvcarvalho neilvcarvalho force-pushed the nc-remove-monkey-patches-spike branch from c615da7 to 8569c8e Compare July 18, 2025 20:25
@neilvcarvalho neilvcarvalho changed the title Spike: Remove some ActiveSupport core_ext paths Cleanup Active Support core extensions Jul 18, 2025
@neilvcarvalho neilvcarvalho marked this pull request as ready for review July 18, 2025 20:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR cleans up unnecessary Active Support core extension requires and optimizes the remaining ones. The changes remove unused hash method extensions and update a require statement to load only the specific class needed rather than core extensions.

  • Removes unused Hash#except! method requirement from evaluator.rb
  • Replaces Hash#with_indifferent_access core extension with direct HashWithIndifferentAccess class requirement in registry.rb

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/factory_bot/registry.rb Updates require to load HashWithIndifferentAccess class directly instead of core extension
lib/factory_bot/evaluator.rb Removes unused Hash#except core extension requirement

@neilvcarvalho
Copy link
Member Author

HashWithIndifferentAccess loads active_support/core_ext/hash/except, so this PR is mostly a no-op. Since we don't use it directly, it's still better not to require it.

I'm merging right away since this is a safe change.

@neilvcarvalho neilvcarvalho merged commit 936f767 into main Jul 18, 2025
25 checks passed
@neilvcarvalho neilvcarvalho deleted the nc-remove-monkey-patches-spike branch July 18, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants