Merge pull request #5899 from betagouv/zeitwerk

Utilisation de zeitwerk, l'auto-loader de Rails 6 (#5887, #5899)
This commit is contained in:
Pierre de La Morinerie 2021-02-11 12:57:15 +01:00 committed by GitHub
commit 3530f4ef6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View file

@ -43,7 +43,6 @@
# published_revision_id :bigint
# service_id :bigint
#
require Rails.root.join('lib', 'percentile')
class Procedure < ApplicationRecord
self.ignored_columns = ['archived_at', 'csv_export_queued', 'xlsx_export_queued', 'ods_export_queued']

View file

@ -17,9 +17,10 @@ module TPS
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
# The default autoloader since Rails 6.0 defaults is zeitwerk.
# However, to split the work, we will move to zeitwerk only in a future PR.
config.autoloader = :classic
Rails.autoloaders.main.ignore(Rails.root.join('lib/cops'))
Rails.autoloaders.main.ignore(Rails.root.join('lib/linters'))
Rails.autoloaders.main.ignore(Rails.root.join('lib/tasks/task_helper.rb'))
config.paths.add Rails.root.join('spec/mailers/previews').to_s, eager_load: true
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.

View file

@ -0,0 +1,3 @@
Dir[File.join(Rails.root, "lib", "core_ext", "*.rb")].each do |core_ext_file|
require core_ext_file
end