A short note & reminder to self about how to remove Action Mailer from a Rails app that doesn’t need it:
- remove its railtie require
- remove all the configuration options referring to
config.action_mailerfrom all the
config/environmentsfiles (by default
The second step is important; if you forget it, the app won’t start
config.action_mailer references in the configuration
files will fail.
If you have
require 'rails/all' at the top of
instead of individual railtie requires, you can substitute it with:
1 2 3 4
Then in this case you can remove the action_mailer one.
You can remove other unnecessary parts in a similar fashion, but they may have a different set of dependencies in gems, configuration files, etc., especially in a legacy app that has accumulated various stuff over time. It’s also possible to dig even deeper and pluck out unnecessary parts from the Rack middleware stack etc., but not going into those in this post.
When starting a fresh new app, remember to check the options for the
rails new command, there are several which will skip installing
specified unneeded parts; see
rails new --help.