aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2005-08-22 21:17:01 +0000
committerJamis Buck <jamis@37signals.com>2005-08-22 21:17:01 +0000
commitae1e85200e1480a47db7c3ccfcc7d256f37e88ba (patch)
tree11b639e34e74dfeed0adf87fe2866ed636b78584 /actionmailer/lib
parent516d920dc31274962813917e8c299403dc815b6c (diff)
downloadrails-ae1e85200e1480a47db7c3ccfcc7d256f37e88ba.tar.gz
rails-ae1e85200e1480a47db7c3ccfcc7d256f37e88ba.tar.bz2
rails-ae1e85200e1480a47db7c3ccfcc7d256f37e88ba.zip
Add a unified render method to ActionMailer (delegates to ActionView::Base#render)
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2037 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionmailer/lib')
-rw-r--r--actionmailer/lib/action_mailer/base.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index fe6a9a4ead..96574fcfd9 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -156,7 +156,7 @@ module ActionMailer #:nodoc:
adv_attr_accessor :recipients, :subject, :body, :from, :sent_on, :headers,
:bcc, :cc, :charset, :content_type, :implicit_parts_order,
- :template
+ :template, :mailer_name
attr_reader :mail
@@ -269,17 +269,23 @@ module ActionMailer #:nodoc:
@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 = {}
end
def render_message(method_name, body)
- initialize_template_class(body).render_file(method_name)
+ render :file => method_name, :body => body
end
-
+
+ def render(opts)
+ body = opts.delete(:body)
+ initialize_template_class(body).render(opts)
+ end
+
def template_path
- template_root + "/" + Inflector.underscore(self.class.name)
+ "#{template_root}/#{mailer_name}"
end
def initialize_template_class(assigns)