-
Notifications
You must be signed in to change notification settings - Fork 247
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
Use a dedicated ActiveSupport::Deprecation #517
Conversation
0c9da83
to
9f18b4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, otherwise looks good to me!
lib/sprockets/railtie.rb
Outdated
@@ -125,6 +125,10 @@ def configure(&block) | |||
Sprockets.register_postprocessor "application/javascript", ::Sprockets::Rails::SourcemappingUrlProcessor | |||
end | |||
|
|||
initializer :deprecator do |app| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initializer :deprecator do |app| | |
initializer "sprockets-rails.deprecator" do |app| |
While the other initializers here don't do this (and probably never will due to backwards incompatibility), I think any new initializers added should be namespaced so that they don't conflict with any other gems.
(Duplicate initializer names has been a problem before: rails/rails#43261 (comment))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum there's already a namespace in the sense that all initializers are defined within a Railtie.
$ bin/rails initializers | grep deprecator
Sprockets::Railtie.deprecator
(Rails 7.0 app running with this branch)
It feels like the issue you're mentioning is more a bug/misfeature in Railtie::Initializable
but OK.
I see all the other deprecators have a namespace in their initializer's name so that makes sense.
Rails 7.1 will deprecate using the singleton ActiveSupport::Deprecation instance. This defines one for the gem and uses it. It's also added to the application's set of deprecators, allowing it to be configured along all the other deprecators.
9f18b4e
to
d8495d0
Compare
Could we get this included in a release please? |
This change causes an exception when we try to initialize our Rails 7.1 app
what could we do to fix that? |
What do you mean by initialize your app? Can you share a backtrace or a repro script? |
Maybe it is solved by newer version, see #525 |
Ok sorry about that (#524), it seems Rails itself used to require So there can be a lot of apps that directly require Similarly if you use only I've opened #527 to make sure this doesn't happen again. |
Rails 7.1 will deprecate using the singleton ActiveSupport::Deprecation instance (rails/rails#47354). This defines one for the gem and uses it.
It's also added to the application's set of deprecators, allowing it to be configured along all the other deprecators.
cc @rafaelfranca