aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib
diff options
context:
space:
mode:
authorMikel Lindsaar <raasdnil@gmail.com>2010-01-22 21:58:13 +1100
committerMikel Lindsaar <raasdnil@gmail.com>2010-01-22 21:58:13 +1100
commit6cf378aeb048e25037a11cabe6338cd893789258 (patch)
treedd2c4ed8efb13eef354d701efd7d8d2c649ac4ff /actionmailer/lib
parent1170e70797e06b3f062e222d912b0cc1dd6072e5 (diff)
parentb30eb39ff072ce95ccd5ce94ae08d116c23fd260 (diff)
downloadrails-6cf378aeb048e25037a11cabe6338cd893789258.tar.gz
rails-6cf378aeb048e25037a11cabe6338cd893789258.tar.bz2
rails-6cf378aeb048e25037a11cabe6338cd893789258.zip
Merge branch 'master' of github.com:mikel/rails
Diffstat (limited to 'actionmailer/lib')
-rw-r--r--actionmailer/lib/action_mailer/base.rb38
-rw-r--r--actionmailer/lib/action_mailer/deprecated_api.rb2
2 files changed, 25 insertions, 15 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 2c1de0e3b4..d75bbe952f 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -277,14 +277,14 @@ module ActionMailer #:nodoc:
@@deliveries = []
cattr_accessor :deliveries
- @@default_charset = "utf-8"
- cattr_accessor :default_charset
+ extlib_inheritable_accessor :default_charset
+ self.default_charset = "utf-8"
- @@default_content_type = "text/plain"
- cattr_accessor :default_content_type
+ extlib_inheritable_accessor :default_content_type
+ self.default_content_type = "text/plain"
- @@default_mime_version = "1.0"
- cattr_accessor :default_mime_version
+ extlib_inheritable_accessor :default_mime_version
+ self.default_mime_version = "1.0"
# This specifies the order that the parts of a multipart email will be. Usually you put
# text/plain at the top so someone without a MIME capable email reader can read the plain
@@ -292,14 +292,24 @@ module ActionMailer #:nodoc:
#
# Any content type that is not listed here will be inserted in the order you add them to
# the email after the content types you list here.
- @@default_implicit_parts_order = [ "text/plain", "text/enriched", "text/html" ]
- cattr_accessor :default_implicit_parts_order
+ extlib_inheritable_accessor :default_implicit_parts_order
+ self.default_implicit_parts_order = [ "text/plain", "text/enriched", "text/html" ]
# Expose the internal Mail message
attr_reader :message
- # Pass calls to headers and attachment to the Mail#Message instance
- delegate :headers, :attachments, :to => :@message
+ def headers(args=nil)
+ if args
+ ActiveSupport::Deprecation.warn "headers(Hash) is deprecated, please do headers[key] = value instead", caller
+ @headers = args
+ else
+ @message
+ end
+ end
+
+ def attachments
+ @message.attachments
+ end
class << self
@@ -386,9 +396,9 @@ module ActionMailer #:nodoc:
m = @message
- m.content_type ||= headers[:content_type] || @@default_content_type
- m.charset ||= headers[:charset] || @@default_charset
- m.mime_version ||= headers[:mime_version] || @@default_mime_version
+ m.content_type ||= headers[:content_type] || self.class.default_content_type
+ m.charset ||= headers[:charset] || self.class.default_charset
+ m.mime_version ||= headers[:mime_version] || self.class.default_mime_version
m.subject = quote_if_necessary(headers[:subject], m.charset) if headers[:subject]
m.to = quote_address_if_necessary(headers[:to], m.charset) if headers[:to]
@@ -398,7 +408,7 @@ module ActionMailer #:nodoc:
m.reply_to = quote_address_if_necessary(headers[:reply_to], m.charset) if headers[:reply_to]
m.date = headers[:date] if headers[:date]
- m.body.set_sort_order(headers[:parts_order] || @@default_implicit_parts_order)
+ m.body.set_sort_order(headers[:parts_order] || self.class.default_implicit_parts_order)
# # Set the subject if not set yet
# @subject ||= I18n.t(:subject, :scope => [:actionmailer, mailer_name, method_name],
diff --git a/actionmailer/lib/action_mailer/deprecated_api.rb b/actionmailer/lib/action_mailer/deprecated_api.rb
index 430b0cef4a..90e2aebf53 100644
--- a/actionmailer/lib/action_mailer/deprecated_api.rb
+++ b/actionmailer/lib/action_mailer/deprecated_api.rb
@@ -227,7 +227,7 @@ module ActionMailer
m.mime_version = mime_version unless mime_version.nil?
m.date = sent_on.to_time rescue sent_on if sent_on
- headers.each { |k, v| m[k] = v }
+ @headers.each { |k, v| m[k] = v }
real_content_type, ctype_attrs = parse_content_type
main_type, sub_type = split_content_type(real_content_type)