Skip to content

Instantly share code, notes, and snippets.

@gabeodess
Created February 3, 2015 05:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabeodess/46d8e0dfcd8960defc4f to your computer and use it in GitHub Desktop.
Save gabeodess/46d8e0dfcd8960defc4f to your computer and use it in GitHub Desktop.
Enabling ActionMailer previews in your production environment
# 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
# 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