Created
February 3, 2015 05:43
-
-
Save gabeodess/46d8e0dfcd8960defc4f to your computer and use it in GitHub Desktop.
Enabling ActionMailer previews in your production environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/initializers/action_mailer.rb | |
class Rails::MailersController | |
protected | |
# The built in controller has a before_action call to :require_local! We override it here to enable use in production. | |
def require_local! | |
# I use the devise gem with active admin so I call authenticate_admin_user! so that only administrators are allowed to preview email templates. | |
authenticate_admin_user! | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/environments/production.rb | |
config.action_mailer.show_previews = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment