mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Change ActionMailer's default caching configuration and update generator's environment templates
This commit is contained in:
parent
f25cc147e9
commit
3d7b0d4804
4 changed files with 13 additions and 1 deletions
|
@ -25,7 +25,7 @@ module ActionMailer
|
|||
options.javascripts_dir ||= paths["public/javascripts"].first
|
||||
options.stylesheets_dir ||= paths["public/stylesheets"].first
|
||||
options.show_previews = Rails.env.development? if options.show_previews.nil?
|
||||
options.perform_caching ||= true
|
||||
options.cache_store ||= Rails.cache
|
||||
|
||||
if options.show_previews
|
||||
options.preview_path ||= defined?(Rails.root) ? "#{Rails.root}/test/mailers/previews" : nil
|
||||
|
|
|
@ -15,12 +15,22 @@ Rails.application.configure do
|
|||
# Enable/disable caching. By default caching is disabled.
|
||||
if Rails.root.join('tmp/caching-dev.txt').exist?
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
<%- unless options.skip_action_mailer? -%>
|
||||
config.action_mailer.perform_caching = false
|
||||
<%- end -%>
|
||||
|
||||
config.cache_store = :memory_store
|
||||
config.public_file_server.headers = {
|
||||
'Cache-Control' => 'public, max-age=172800'
|
||||
}
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
||||
<%- unless options.skip_action_mailer? -%>
|
||||
config.action_mailer.perform_caching = false
|
||||
<%- end -%>
|
||||
|
||||
config.cache_store = :null_store
|
||||
end
|
||||
<%- unless options.skip_action_mailer? -%>
|
||||
|
|
|
@ -71,6 +71,7 @@ Rails.application.configure do
|
|||
# config.active_job.queue_adapter = :resque
|
||||
# config.active_job.queue_name_prefix = "<%= app_name %>_#{Rails.env}"
|
||||
<%- unless options.skip_action_mailer? -%>
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Ignore bad email addresses and do not raise email delivery errors.
|
||||
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
||||
|
|
|
@ -28,6 +28,7 @@ Rails.application.configure do
|
|||
# Disable request forgery protection in test environment.
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
<%- unless options.skip_action_mailer? -%>
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
# The :test delivery method accumulates sent emails in the
|
||||
|
|
Loading…
Reference in a new issue