Rails is split into a large number of (sub-) frameworks.
The most important and central of those are
However, there are also some more situational frameworks included, such as
You might not need all of these frameworks in every app, so in the interest of startup time and memory usage, you can disable them. To do that, simply comment out the appropriate lines in config/application.rb
. You'll also have to remove some configuration options, but you'll receive appropriate error messages.
If your application.rb
only has require 'rails/all'
, you need to replace that line with individual requires for the frameworks you would like to keep.
Since every gem from your gemfile is loaded, set require: false
in your gemfile for any not needed sub-framework (e.g. gem 'actionmailer', require: false
) as well.
When you look into the definition of rails/all
(in railites-x.x.x/lib-/rails/all.rb
) you can find the exact path for requiring the sub-frameworks.
If your application now fails on start up, make sure that no configs are set for the now un-required frameworks. Some settings can be set by the default rails app generator.
%w(
active_record/railtie
action_controller/railtie
action_view/railtie
action_mailer/railtie
action_mailbox/engine
).each do |railtie|
require railtie
end