在邮件通知ruby

时间:2017-11-23 11:47:14

标签: html ruby render actionmailer unescapestring

如何避免在下面的渲染标记中取消HTML。

nofiy_user.html.erb:

<%= render partial: "mailer_notifier/paragraph", :locals => {:asHtml => asHtml, :htmltext => I18n.t('notifications.you_added_user', resource_type: @resource_type, role: @role, resource_name: @resource_name) + ":"} %>

1 个答案:

答案 0 :(得分:0)

尝试'原始'方法。像这样的东西,

<%= render partial: "mailer_notifier/paragraph", :locals => {:asHtml => raw(asHtml), :htmltext => I18n.t('notifications.you_added_user', resource_type: @resource_type, role: @role, resource_name: @resource_name) + ":"} %>

我假设你想在mailer_notifier /段中unescape asHtml值。如果您的需求与我的假设不同,那么您可以考虑使用“原始”方法。