2009-08-24 18 views
1

複数のメーラ "アクション"に同じアクションメーラテンプレートを再利用するにはどうすればよいですか?再利用アクションメーラテンプレート

ActionControllerでは、

... 
render :action => 'another_action' 

は、私は同じことがactionmailerの中で行うことができます想像行うことができますが、私は右の方法を見つけるように見えることができませんでした。それが適切であれば、私はRails 2.3.2を使っています。

ありがとうございます!

答えて

1

あなたはrender_messageを探していますが、API Docs Multipart Messageセクションには良い例があります - 下に貼り付けられています。

class ApplicationMailer < ActionMailer::Base 
    def signup_notification(recipient) 
    recipients  recipient.email_address_with_name 
    subject   "New account information" 
    from   "[email protected]" 
    content_type "multipart/alternative" 

    part :content_type => "text/html", 
     :body => render_message("signup-as-html", :account => recipient) 

    part "text/plain" do |p| 
     p.body = render_message("signup-as-plain", :account => recipient) 
     p.transfer_encoding = "base64" 
    end 
    end 
end 
+0

この例は現在そのページから削除されています。また、 'render_message'についての言及もなく、v2.3.8から削除されているようです。/cc @mike –