【发布时间】:2014-09-18 14:40:58
【问题描述】:
我有两个派生自 ActionMailer 的类。但是它们的设计模板将是相同的。我将使用布局。我现在做的是
在提醒课中
Class Reminders < ActionMailer::Base
layouts :mailer_template
end
在警报类中
Class Alerts < ActionMailer::Base
layouts :mailer_template
end
在布局中我有 mailer_template.html
我的另一种方法是创建两个布局,称为reminders.html 和alerts.html,因为它们共享相同的代码,我可以有一个名为_mailer_template.html 的部分并在类中呈现这个部分。
现在在这里使用哪种最佳做法?
【问题讨论】:
标签: ruby-on-rails layout actionmailer partials