discourse/lib/zeitwerk_config.rb
Krzysztof Kotlarek e10a74694a
FIX: deprecation warning - initialization autoloaded the constant (#12400)
Get rid of deprecation related to Zeitwerk autoloader.

Original PR was reverted because of multisite bug #12381 - thank you @davidtaylorhq for fixing it.

I added the last commit to fix that multisite problem.
2021-03-16 09:47:57 +11:00

24 lines
779 B
Ruby

# frozen_string_literal: true
module ActiveSupport::Dependencies::ZeitwerkIntegration::Inflector
CUSTOM_PATHS = {
'canonical_url' => 'CanonicalURL',
'clean_up_unmatched_ips' => 'CleanUpUnmatchedIPs',
'homepage_constraint' => 'HomePageConstraint',
'ip_addr' => 'IPAddr',
'onpdiff' => 'ONPDiff',
'onceoff' => 'Jobs',
'pop3_polling_enabled_setting_validator' => 'POP3PollingEnabledSettingValidator',
'regular' => 'Jobs',
'scheduled' => 'Jobs',
'topic_query_sql' => 'TopicQuerySQL',
'version' => 'Discourse',
}
def self.camelize(basename, abspath)
return basename.camelize if abspath.ends_with?("onceoff.rb")
return 'Jobs' if abspath.ends_with?("jobs/base.rb")
CUSTOM_PATHS.fetch(basename, basename.camelize)
end
end