Skip to content
Browse files

Allow Mailers to have custom initialize methods that set default inst…

…ance 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
  • Loading branch information...
1 parent dd257a3 commit 95e8740fdec01b2beb8f6012f9cc38d2c89122eb @dhh dhh committed Oct 26, 2005
Showing with 13 additions and 9 deletions.
  1. +5 −0 actionmailer/CHANGELOG
  2. +8 −9 actionmailer/lib/action_mailer/base.rb
View
5 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
View
17 actionmailer/lib/action_mailer/base.rb
@@ -337,15 +337,14 @@ def deliver!(mail = @mail)
# 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

0 comments on commit 95e8740

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