public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Mailer template root applies to a class and its subclasses rather than 
acting globally.

Allows to have two mailers in the application which have the same action 
names. 


git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@4694 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Tobias Lütke (author)
Sun Aug 06 22:34:21 -0700 2006
commit  14ed31db219dd9ed6bc11fab181c8e1b42700c30
tree    97be7f5423ded7b855433c4c07f1891f664c3b24
parent  2699e58eb53956059a17d932dbd37f01447931c5
...
 
 
1
2
3
...
1
2
3
4
5
0
@@ -1,3 +1,5 @@
0
+* Mailer template root applies to a class and its subclasses rather than acting globally. #5555 [somekool@gmail.com]
0
+
0
 *1.2.3* (June 29th, 2006)
0
 
0
 * Depend on Action Pack 1.12.3
...
127
128
129
130
 
131
132
133
...
127
128
129
 
130
131
132
133
0
@@ -127,7 +127,7 @@ module ActionMailer #:nodoc:
0
     
0
     private_class_method :new #:nodoc:
0
 
0
- cattr_accessor :template_root
0
+ class_inheritable_accessor :template_root
0
     cattr_accessor :logger
0
 
0
     @@server_settings = {
...
24
25
26
 
 
27
28
29
...
816
817
818
 
 
 
 
 
 
 
 
 
 
 
 
...
24
25
26
27
28
29
30
31
...
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
0
@@ -24,6 +24,8 @@ class Net::SMTP
0
 end
0
 
0
 class FunkyPathMailer < ActionMailer::Base
0
+ self.template_root = "#{File.dirname(__FILE__)}/fixtures/path.with.dots"
0
+
0
   def multipart_with_template_path_with_dots(recipient)
0
     recipients recipient
0
     subject "Have a lovely picture"
0
@@ -816,3 +818,15 @@ EOF
0
   end
0
 end
0
 
0
+class InheritableTemplateRootTest < Test::Unit::TestCase
0
+ def test_attr
0
+ expected = "#{File.dirname(__FILE__)}/fixtures/path.with.dots"
0
+ assert_equal expected, FunkyPathMailer.template_root
0
+
0
+ sub = Class.new(FunkyPathMailer)
0
+ sub.template_root = 'test/path'
0
+
0
+ assert_equal 'test/path', sub.template_root
0
+ assert_equal expected, FunkyPathMailer.template_root
0
+ end
0
+end

Comments

    No one has commented yet.