From 98fe07a946543a6f4d2d7dc9758f0145e1ab932e Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Wed, 6 Jan 2016 15:29:22 +0800 Subject: Move ActionMailer::Caching's content into ActionMailer::Base instead of including it Remove useless helper in ActionDispatch::Caching and fix indentation --- actionmailer/lib/action_mailer/base.rb | 16 +++++++++++++++- actionmailer/lib/action_mailer/caching.rb | 22 ---------------------- 2 files changed, 15 insertions(+), 23 deletions(-) delete mode 100644 actionmailer/lib/action_mailer/caching.rb (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 9b14a96d48..25be5c3a7f 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -6,6 +6,8 @@ require 'active_support/core_ext/module/anonymous' require 'action_mailer/log_subscriber' +require 'action_dispatch/caching' + module ActionMailer # Action Mailer allows you to send email from your application using a mailer model and views. # @@ -420,7 +422,6 @@ module ActionMailer class Base < AbstractController::Base include DeliveryMethods include Previews - include Caching abstract! @@ -431,6 +432,7 @@ module ActionMailer include AbstractController::Translation include AbstractController::AssetPaths include AbstractController::Callbacks + include ActionDispatch::Caching include ActionView::Layouts @@ -828,6 +830,18 @@ module ActionMailer message end + # This and #instrument_name is for caching instrument + def instrument_payload(key) + { + mailer: mailer_name, + key: key + } + end + + def instrument_name + "action_mailer" + end + protected # Used by #mail to set the content type of the message. diff --git a/actionmailer/lib/action_mailer/caching.rb b/actionmailer/lib/action_mailer/caching.rb deleted file mode 100644 index 8e659981a1..0000000000 --- a/actionmailer/lib/action_mailer/caching.rb +++ /dev/null @@ -1,22 +0,0 @@ -require 'action_dispatch/caching' - -module ActionMailer - module Caching - extend ActiveSupport::Autoload - extend ActiveSupport::Concern - included do - include ActionDispatch::Caching - end - - def instrument_payload(key) - { - mailer: mailer_name, - key: key - } - end - - def instrument_name - "action_mailer" - end - end -end -- cgit v1.2.3