【发布时间】:2019-01-14 22:29:48
【问题描述】:
最近刚开始从事一个正在进行的项目,我需要为电子邮件布局集成模板。 我在 app/mailers/admin_mailer.rb 中有 admin_mailer.rb,其中包含以下内容:
class AdminMailer < ApplicationMailer
before_action { @all_admins = AdminUser.all.pluck(:email) }
default to: -> { @all_admins }
def contact(contact_message)
@message = contact_message.question
@name = contact_message.name
@email = contact_message.email
mail subject: I18n.t('emails.contact_request', name: @name), from: @email
end
end
在 app/views/admin_mailer/contact.html.slim 我有
- content_for(:header) do
title= t('emails.contact_request')
h2 #{@name} some text here
p sender: #{@name}
p email: #{@email}
br
p message: #{@message}
我搜索了 html.slim 电子邮件模板并遇到了这个:https://gist.github.com/mkhairi/7eee8bea87a63171563e 但无法使模板出现
如何将模板用于contact.html.slim 文件,以便更改布局。您是否碰巧知道其他可用于 ruby on rails 的模板?
【问题讨论】:
-
你找到解决办法了吗?
标签: ruby-on-rails email templates slim-lang