I have two classes that derive from ActionMailer. But the deisgn template for both of them are going to be the same. I am going to use layouts. What I have done now is
In Reminder class
Class Reminders < ActionMailer::Base
layouts :mailer_template
end
In Alert class
Class Alerts < ActionMailer::Base
layouts :mailer_template
end
In layouts I have mailer_template.html
Another way I have is to create two layouts called reminders.html and alerts.html and as they both share the same code I can have a partial called _mailer_template.html and render this partial in bith the classes.
Now which is the best practice to use here?
as for me: you don't need create unnecessary files reminders.html, alerts.html, _shared_partial.html
just use layouts :layout_name
. Even If in future you will need separate layouts you will be able to do this (but now you don't need it).
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다