aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-10-26 13:02:58 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-10-26 13:02:58 +0000
commit95e8740fdec01b2beb8f6012f9cc38d2c89122eb (patch)
tree214b85b6d407e2fa9155e23e4349934a0c4991d9 /actionmailer
parentdd257a3ccb30ab181cd48d3d81bc7f23bb45f36f (diff)
downloadrails-95e8740fdec01b2beb8f6012f9cc38d2c89122eb.tar.gz
rails-95e8740fdec01b2beb8f6012f9cc38d2c89122eb.tar.bz2
rails-95e8740fdec01b2beb8f6012f9cc38d2c89122eb.zip
Allow Mailers to have custom initialize methods that set default instance variables for all mail actions (closes #2563) [mrj@bigpond.net.au]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2742 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/CHANGELOG5
-rw-r--r--actionmailer/lib/action_mailer/base.rb17
2 files changed, 13 insertions, 9 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG
index 7a1c1c664c..d2b27bf029 100644
--- a/actionmailer/CHANGELOG
+++ b/actionmailer/CHANGELOG
@@ -1,3 +1,8 @@
+*SVN*
+
+* Allow Mailers to have custom initialize methods that set default instance variables for all mail actions #2563 [mrj@bigpond.net.au]
+
+
*1.1.2* (October 26th, 2005)
* Upgraded to Action Pack 1.10.2
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index a77f9ce018..aa1fb648a0 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -337,15 +337,14 @@ module ActionMailer
# mailer. Subclasses may override this method to provide different
# defaults.
def initialize_defaults(method_name)
- @bcc = @cc = @from = @recipients = @sent_on = @subject = nil
- @charset = @@default_charset.dup
- @content_type = @@default_content_type.dup
- @implicit_parts_order = @@default_implicit_parts_order.dup
- @template = method_name
- @mailer_name = Inflector.underscore(self.class.name)
- @parts = []
- @headers = {}
- @body = {}
+ @charset ||= @@default_charset.dup
+ @content_type ||= @@default_content_type.dup
+ @implicit_parts_order ||= @@default_implicit_parts_order.dup
+ @template ||= method_name
+ @mailer_name ||= Inflector.underscore(self.class.name)
+ @parts ||= []
+ @headers ||= {}
+ @body ||= {}
@mime_version = @@default_mime_version.dup if @@default_mime_version
end