Skip mailers while generating Rails 5 app

Abhishek Jain

By Abhishek Jain

on July 8, 2016

This blog is part of our  Rails 5 series.

We can now skip requiring Action Mailer while generating Rails 5 app.

2$ rails new my_app --skip-action-mailer
4# OR
6$ rails new my_app -M

This comments out requiring action_mailer/railtie in application.rb.

It also omits mailer specific configurations such as config.action_mailer.raise_delivery_errors and config.action_mailer.perform_caching in production/development and config.action_mailer.delivery_method by default in test environment.

2# application.rb
4require "rails"
5require "active_model/railtie"
6require "active_job/railtie"
7require "active_record/railtie"
8require "action_controller/railtie"
9# require "action_mailer/railtie"
10require "action_view/railtie"
11require "action_cable/engine"
12require "sprockets/railtie"
13require "rails/test_unit/railtie"

As, we can see action_mailer/railtie is commented out.

If you liked this blog, you might also like the other blogs we have written. Check out the full archive.

Stay up to date with our blogs. Sign up for our newsletter.

We write about Ruby on Rails, React.js, React Native, remote work,open source, engineering & design.