Skip to content

Instantly share code, notes, and snippets.

@bdcheung
Created February 19, 2016 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdcheung/8ea39d49b0fc97d29117 to your computer and use it in GitHub Desktop.
Save bdcheung/8ea39d49b0fc97d29117 to your computer and use it in GitHub Desktop.
Enable ActionMailer previews in staging
Rails::Application.configure do
#########################
# Other config settings #
#########################
# Enable ActionMailer previews in staging
config.action_mailer.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil
config.autoload_paths += [config.action_mailer.preview_path]
routes.append do
get '/rails/mailers' => "rails/mailers#index"
get '/rails/mailers/*path' => "rails/mailers#preview"
end
end
class ::Rails::MailersController
include Rails.application.routes.url_helpers
def local_request?
true
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment