Require only used parts of Rails (#2988)
Rails by defaults loads all its railties and engines, the current app does not use neither ActiveStorage, nor ActionCable nor TestUnit. We can, hence, dispense of them.
This commit is contained in:
parent
ac6ba0f69b
commit
6ea4b55658
2 changed files with 14 additions and 2 deletions
|
|
@ -1,6 +1,18 @@
|
|||
require_relative "boot"
|
||||
|
||||
require "rails/all"
|
||||
# only require Rails parts that we actually use, this shaves off some memory
|
||||
# ActiveStorage, ActionCable and TestUnit are not currently used by the app
|
||||
# see <https://github.com/rails/rails/blob/v5.2.3/railties/lib/rails/all.rb>
|
||||
%w[
|
||||
active_record/railtie
|
||||
action_controller/railtie
|
||||
action_view/railtie
|
||||
action_mailer/railtie
|
||||
active_job/railtie
|
||||
sprockets/railtie
|
||||
].each do |railtie|
|
||||
require railtie
|
||||
end
|
||||
|
||||
# Require the gems listed in Gemfile, including any gems
|
||||
# you've limited to :test, :development, or :production.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ Rails.application.configure do
|
|||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# Store uploaded files on the local file system in a temporary directory
|
||||
config.active_storage.service = :test
|
||||
# config.active_storage.service = :test
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue