From 3f8409193716669b9fa61ac74ae1c92cfde00785 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 29 Jan 2010 16:16:01 +0100 Subject: ActionMailer should depend just on AbstractController. --- actionmailer/lib/action_mailer.rb | 10 +++++++++- actionmailer/lib/action_mailer/base.rb | 6 ------ actionmailer/lib/action_mailer/railtie.rb | 4 ++++ 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb index 17f63aca25..0265e6e222 100644 --- a/actionmailer/lib/action_mailer.rb +++ b/actionmailer/lib/action_mailer.rb @@ -24,9 +24,17 @@ actionpack_path = File.expand_path('../../../actionpack/lib', __FILE__) $:.unshift(actionpack_path) if File.directory?(actionpack_path) && !$:.include?(actionpack_path) -require 'action_controller' +require 'abstract_controller' require 'action_view' +# Common ActiveSupport usage in ActionMailer +require 'active_support/core_ext/class' +require 'active_support/core_ext/object/blank' +require 'active_support/core_ext/array/uniq_by' +require 'active_support/core_ext/module/attr_internal' +require 'active_support/core_ext/module/delegation' +require 'active_support/core_ext/string/inflections' + module ActionMailer extend ::ActiveSupport::Autoload diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 6246530bf0..32959e3943 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -1,8 +1,3 @@ -require 'active_support/core_ext/class' -require 'active_support/core_ext/object/blank' -require 'active_support/core_ext/array/uniq_by' -require 'active_support/core_ext/module/delegation' -require 'active_support/core_ext/string/inflections' require 'mail' require 'action_mailer/tmail_compat' require 'action_mailer/collector' @@ -254,7 +249,6 @@ module ActionMailer #:nodoc: include AbstractController::LocalizedCache include AbstractController::Layouts include AbstractController::Helpers - include AbstractController::UrlFor include AbstractController::Translation helper ActionMailer::MailHelper diff --git a/actionmailer/lib/action_mailer/railtie.rb b/actionmailer/lib/action_mailer/railtie.rb index 7ed1519e36..4ed70503fd 100644 --- a/actionmailer/lib/action_mailer/railtie.rb +++ b/actionmailer/lib/action_mailer/railtie.rb @@ -17,5 +17,9 @@ module ActionMailer ActionMailer::Base.send "#{k}=", v end end + + initializer "action_mailer.url_for" do |app| + ActionMailer::Base.send(:include, ActionController::UrlFor) if defined?(ActionController) + end end end \ No newline at end of file -- cgit v1.2.3 From 0e063f435ce31a091d1097156172d551bd9d9d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 30 Jan 2010 16:35:22 +0100 Subject: Fix some backward incompatible behavior on AM. --- actionmailer/lib/action_mailer/base.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 32959e3943..dc451417d7 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -250,6 +250,7 @@ module ActionMailer #:nodoc: include AbstractController::Layouts include AbstractController::Helpers include AbstractController::Translation + include AbstractController::Compatibility helper ActionMailer::MailHelper -- cgit v1.2.3 From 2d567e470adb9241b400e02ccb0501efb7d09b14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 30 Jan 2010 16:39:27 +0100 Subject: Add transfer_encoding= setter deprecation. --- actionmailer/lib/action_mailer/tmail_compat.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/tmail_compat.rb b/actionmailer/lib/action_mailer/tmail_compat.rb index c6efdc53b6..26962f972f 100644 --- a/actionmailer/lib/action_mailer/tmail_compat.rb +++ b/actionmailer/lib/action_mailer/tmail_compat.rb @@ -17,7 +17,13 @@ module Mail old_transfer_encoding end end - + + def transfer_encoding=(value) + ActiveSupport::Deprecation.warn('Message#transfer_encoding= is deprecated, please call ' << + 'Message#content_transfer_encoding= with the same arguments', caller[0,2]) + self.content_transfer_encoding = value + end + def original_filename ActiveSupport::Deprecation.warn('Message#original_filename is deprecated, ' << 'please call Message#filename', caller[0,2]) -- cgit v1.2.3