From b6b3db6734af8d5b42c7bdcea7c73923a5b88463 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Thu, 28 Jan 2010 00:24:30 +1100 Subject: Fixed bug on HTML only emails getting set to text/plain --- actionmailer/lib/action_mailer/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionmailer/lib/action_mailer/base.rb') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 2288a30691..3fbf004a0d 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -531,7 +531,7 @@ module ActionMailer #:nodoc: when m.multipart? ["multipart", "alternative", params] else - class_default + m.content_type || class_default end end -- cgit v1.2.3 From 452bb1e48d7fa3dd4b2684d9d8ba3091200d59fe Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Wed, 27 Jan 2010 19:37:47 -0800 Subject: Rename 'defaults' class method to 'default' to reflect that it's a declaration --- actionmailer/lib/action_mailer/base.rb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'actionmailer/lib/action_mailer/base.rb') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 3fbf004a0d..6246530bf0 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -23,8 +23,8 @@ module ActionMailer #:nodoc: # Examples: # # class Notifier < ActionMailer::Base - # defaults :from => 'no-reply@example.com', - # :return_path => 'system@example.com' + # default :from => 'no-reply@example.com', + # :return_path => 'system@example.com' # # def welcome(recipient) # @account = recipient @@ -191,7 +191,7 @@ module ActionMailer #:nodoc: # # These options are specified on the class level, like ActionMailer::Base.template_root = "/my/templates" # - # * defaults - This is a class wide hash of :key => value pairs containing + # * default - This is a class wide hash of :key => value pairs containing # default values for the specified header fields of the Mail::Message. You can # specify a default for any valid header for Mail::Message and it will be used if # you do not override it. The defaults set by Action Mailer are: @@ -232,16 +232,16 @@ module ActionMailer #:nodoc: # * deliveries - Keeps an array of all the emails sent out through the Action Mailer with delivery_method :test. Most useful # for unit and functional testing. # - # * default_charset - This is now deprecated, use the +defaults+ method above to + # * default_charset - This is now deprecated, use the +default+ method above to # set the default +:charset+. # - # * default_content_type - This is now deprecated, use the +defaults+ method above + # * default_content_type - This is now deprecated, use the +default+ method above # to set the default +:content_type+. # - # * default_mime_version - This is now deprecated, use the +defaults+ method above + # * default_mime_version - This is now deprecated, use the +default+ method above # to set the default +:mime_version+. # - # * default_implicit_parts_order - This is now deprecated, use the +defaults+ method above + # * default_implicit_parts_order - This is now deprecated, use the +default+ method above # to set the default +:parts_order+. Parts Order is used when a message is built implicitly # (i.e. multiple parts are assembled from templates which specify the content type in their # filenames) this variable controls how the parts are ordered. @@ -280,7 +280,7 @@ module ActionMailer #:nodoc: attr_writer :mailer_name alias :controller_path :mailer_name - def defaults(value=nil) + def default(value=nil) self.default_params.merge!(value) if value self.default_params end @@ -429,13 +429,13 @@ module ActionMailer #:nodoc: # * :reply_to - Who to set the Reply-To header of the email to. # * :date - The date to say the email was sent on. # - # You can set default values for any of the above headers (except :date) by using the defaults + # You can set default values for any of the above headers (except :date) by using the default # class method: # # class Notifier < ActionMailer::Base - # self.defaults :from => 'no-reply@test.lindsaar.net', - # :bcc => 'email_logger@test.lindsaar.net', - # :reply_to => 'bounces@test.lindsaar.net' + # self.default :from => 'no-reply@test.lindsaar.net', + # :bcc => 'email_logger@test.lindsaar.net', + # :reply_to => 'bounces@test.lindsaar.net' # end # # If you need other headers not listed above, use the headers['name'] = value method. @@ -487,7 +487,7 @@ module ActionMailer #:nodoc: parts_order = headers[:parts_order] # Merge defaults from class - headers = headers.reverse_merge(self.class.defaults) + headers = headers.reverse_merge(self.class.default) charset = headers[:charset] # Quote fields @@ -562,7 +562,7 @@ module ActionMailer #:nodoc: elsif headers[:body] responses << { :body => headers[:body], - :content_type => self.class.defaults[:content_type] || "text/plain" + :content_type => self.class.default[:content_type] || "text/plain" } else each_template do |template| -- cgit v1.2.3