Skip to content

Add configuration to enable mail previews#15970

Merged
rafaelfranca merged 1 commit into
rails:masterfrom
lengarvey:add_configuration_option_for_mail_preview
Jul 1, 2014
Merged

Add configuration to enable mail previews#15970
rafaelfranca merged 1 commit into
rails:masterfrom
lengarvey:add_configuration_option_for_mail_preview

Conversation

@lengarvey

Copy link
Copy Markdown
Contributor

Adds config.action_mailer.preview_enabled

This allows mail previewing to be enabled easily in non-development
environments such as staging. The default is set to true for development
so no changes should be required to existing Rails applications.

The mail preview path can still be configured using the existing
config.action_mailer.preview_path configuration option.

Adding this prevents devs from having to do stuff like:

  config.action_mailer.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil

  routes.append do
    get '/rails/mailers'         => "rails/mailers#index"
    get '/rails/mailers/*path'   => "rails/mailers#preview"
  end

in order to enable mail previewing on staging.

Comment thread actionmailer/CHANGELOG.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/staging/development/?

@chancancode chancancode added this to the 4.2.0 milestone Jun 29, 2014
@chancancode

Copy link
Copy Markdown
Member

@pixeltrix does the overall feature seems fine to you?

@lengarvey

Copy link
Copy Markdown
Contributor Author

I reworked this so there aren't any more changes inside railties/lib except to remove the route appending from the finisher. This also lets me place the configuration item in config.action_mailer instead of adding a global configuration item.

@rafaelfranca

Copy link
Copy Markdown
Member

We need to update the configuration guides to add this new config.

@lengarvey

Copy link
Copy Markdown
Contributor Author

I've updated the configuration guides to include both this new config and the existing config.action_mailer.preview_path config which didn't seem to be covered.

@guilleiguaran

Copy link
Copy Markdown
Member

Please squash your commits on a single one

Adds `config.action_mailer.preview_enabled`

This allows mail previewing to be enabled easily in non-development
environments such as staging. The default is set to true for development
so no changes should be required to existing Rails applications.

The mail preview path can still be configured using the existing
`config.action_mailer.preview_path` configuration option.

Adding this avoids devs from having to do stuff like:
https://gist.github.com/lengarvey/fa2c9bd6cdbeba96526a

Update actionmailer/CHANGELOG with new configuration.
Update configuring guide with new configuratation.
Add `config.action_mailer.preview_path` to configuring guide.
@rafaelfranca
rafaelfranca merged commit 84ed7b8 into rails:master Jul 1, 2014
rafaelfranca added a commit that referenced this pull request Jul 1, 2014
…_mail_preview

Add configuration to enable mail previews
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants