aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorStan Lo <a22301613@yahoo.com.tw>2016-01-06 15:29:22 +0800
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-02-23 21:06:41 -0300
commit98fe07a946543a6f4d2d7dc9758f0145e1ab932e (patch)
treedd66e6e1bab8ea6ac0343980854055606f772738 /actionmailer
parent1de6f7938dbc58a618a89397aad5f217a6221d17 (diff)
downloadrails-98fe07a946543a6f4d2d7dc9758f0145e1ab932e.tar.gz
rails-98fe07a946543a6f4d2d7dc9758f0145e1ab932e.tar.bz2
rails-98fe07a946543a6f4d2d7dc9758f0145e1ab932e.zip
Move ActionMailer::Caching's content into ActionMailer::Base instead of including it
Remove useless helper in ActionDispatch::Caching and fix indentation
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/lib/action_mailer/base.rb16
-rw-r--r--actionmailer/lib/action_mailer/caching.rb22
-rw-r--r--actionmailer/test/caching_test.rb2
3 files changed, 15 insertions, 25 deletions
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
diff --git a/actionmailer/test/caching_test.rb b/actionmailer/test/caching_test.rb
index e48d2042ac..b4344eb167 100644
--- a/actionmailer/test/caching_test.rb
+++ b/actionmailer/test/caching_test.rb
@@ -10,8 +10,6 @@ FILE_STORE_PATH = File.join(File.dirname(__FILE__), '/../temp/', CACHE_DIR)
class FragmentCachingMailer < ActionMailer::Base
abstract!
- include ActionMailer::Caching
-
def some_action; end
end