8000 Require active_support's inflections module before requiring the delegation module by es · Pull Request #733 · flyerhzm/bullet · GitHub
[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Require active_support's inflections module before requiring the delegation module #733

Conversation

es
Copy link
Contributor
@es es commented Feb 6, 2025

When using bullet with Active Support on version 7.2 or greater, in a non-Rails project, an error is thrown during the initial load:

/Users/emil/.asdf/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/delegation.rb:47:in `generate': uninitialized constant #<Class:ActiveSupport::Delegation>::Inflector (NameError)

          unless Inflector.safe_constantize(to.name).equal?(to)
                 ^^^^^^^^^
        from /Users/emil/.asdf/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/core_ext/module/delegation.rb:161:in `delegate'
        from /Users/emil/.asdf/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bullet-7.2.0/lib/bullet.rb:53:in `singleton class'
        from /Users/emil/.asdf/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bullet-7.2.0/lib/bullet.rb:35:in `<module:Bullet>'
        from /Users/emil/.asdf/installs/ruby/3.3.6/lib/ruby/gems/3.3.0/gems/bullet-7.2.0/lib/bullet.rb:11:in `<top (required)>'

This is due to a change in Rails which expects active_support to be required before any modules are cherry-picked: rails/rails#52582.

This PR adds that require.

@flyerhzm
Copy link
Owner
flyerhzm commented Feb 7, 2025

@es does it just need to require active_support inflector?

@es es force-pushed the es/require-active-support-before-cherry-picking-module branch from fb95650 to d65c0bd Compare February 7, 2025 16:44
@es es changed the title Require top-level active_support before requiring delegation module Require active_support's inflections module before requiring the delegation module Feb 7, 2025
@es
Copy link
Contributor Author
es commented Feb 7, 2025

Good catch! I've updated the PR to just require the inflections module. Also here's a minimum gist that errors before the change, but doesn't after: https://gist.github.com/es/32e497e62d74d00d433eac633ae3c1e6

@flyerhzm flyerhzm merged commit deddbe1 into flyerhzm:main Feb 8, 2025
10 checks passed
@flyerhzm
Copy link
Owner
flyerhzm commented Feb 8, 2025

@es thanks for fixing it.

@es
Copy link
Contributor Author
es commented Feb 9, 2025

@flyerhzm thank you for merging this! When you get a chance, could you please cut/release a new patch version so we can pick up this change? 🙏

@es es deleted the es/require-active-support-before-cherry-picking-module branch February 9, 2025 18:02
@flyerhzm
Copy link
Owner

@es yes, I just released bullet 8.0.1.

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
0