Skip to content
Browse files

Load AV::Layout to AM::Base in railties

  • Loading branch information...
1 parent 2a25c4c commit d1760253f5a5c26b8b1d0f38f4f288d759fbb306 @lukaszx0 lukaszx0 committed
View
2 actionmailer/lib/action_mailer/base.rb
@@ -368,8 +368,6 @@ class Base < AbstractController::Base
include AbstractController::Rendering
- include ActionView::Layouts
-
include AbstractController::Logger
include AbstractController::Helpers
include AbstractController::Translation
View
3 actionmailer/test/abstract_unit.rb
@@ -13,6 +13,9 @@
require 'action_mailer/test_case'
require 'mail'
+# Emulate AV railtie
+ActionMailer::Base.send(:include, ActionView::Layouts)
+
# Show backtraces for deprecated behavior for quicker cleanup.
ActiveSupport::Deprecation.debug = true
View
4 actionmailer/test/i18n_with_controller_test.rb
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'action_view'
require 'action_controller'
class I18nTestMailer < ActionMailer::Base
@@ -14,6 +15,9 @@ def mail_with_i18n_subject(recipient)
end
end
+# Emulate AV railtie
+ActionController::Base.superclass.send(:include, ActionView::Layouts)
+
class TestController < ActionController::Base
def send_mail
I18nTestMailer.mail_with_i18n_subject("test@localhost").deliver
View
3 actionpack/test/controller/assert_select_test.rb
@@ -8,6 +8,9 @@
require 'controller/fake_controllers'
require 'action_mailer'
+require 'action_view'
+
+ActionMailer::Base.send(:include, ActionView::Layouts)
ActionMailer::Base.view_paths = FIXTURE_LOAD_PATH
class AssertSelectTest < ActionController::TestCase
View
6 actionview/lib/action_view/railtie.rb
@@ -41,5 +41,11 @@ class Railtie < Rails::Railtie # :nodoc:
ActionController::Base.superclass.send(:include, ActionView::Layouts)
end
end
+
+ initializer "action_view.setup_action_mailer" do |app|
+ ActiveSupport.on_load(:action_mailer) do
+ ActionMailer::Base.send(:include, ActionView::Layouts)
+ end
+ end
end
end

0 comments on commit d176025

Please sign in to comment.
Something went wrong with that request. Please try again.