-
-
Save nunommc/5788d774a9e2ffcd23b5 to your computer and use it in GitHub Desktop.
Enabling Rails 4.1 mail previews in staging (or any other env besides development)
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
# put this in your staging.rb file. Obviously you'll need more config than this it's just an example. | |
Rails.application.configure do | |
config.action_mailer.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/spec/mailers/previews" : nil | |
config.action_mailer.show_previews = true | |
end | |
# Without the following would display "For security purposes, this information is only available to local requests" | |
class ::Rails::MailersController | |
include Rails.application.routes.url_helpers | |
def local_request? | |
true | |
end | |
end | |
# assuming you've configured your mail previews in your test folder this will work fine |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment