mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 00:43:39 +08:00
e10a74694a
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.
14 lines
515 B
Ruby
14 lines
515 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Multisite freedom patch defines RailsMultisite::DiscoursePatches.config which is used by 200-first_middlewares.rb
|
|
# Therefore it can not be postponed with .to_prepare
|
|
RUN_WITHOUT_PREPARE = ["#{Rails.root}/lib/freedom_patches/rails_multisite.rb"]
|
|
RUN_WITHOUT_PREPARE.each { |path| require(path) }
|
|
|
|
Rails.application.reloader.to_prepare do
|
|
Dir["#{Rails.root}/lib/freedom_patches/*.rb"].each do |f|
|
|
next if RUN_WITHOUT_PREPARE.any? { |path| path == f }
|
|
require(f)
|
|
end
|
|
end
|