此处,视图默认为“test_email.html”。
/_api/web/lists/getbytitle('Anwendungen')/items
我想要的是如下: 对于test_case_3,渲染“test_case_3.html” 对于其余部分,将“test_email”渲染为默认值 我怎么能实现它?
答案 0 :(得分:1)
def test_email(data)
notif_type = data['notif_type']
emails_list = ['132xxy@yahoo.com', '133xxy@yahoo.com']
@template = 'test_email'
subject = case notif_type
when 'test_case_3'
@template = 'test_case_3.html'
"test3"
when 'test_case_1'
"test1"
when 'test_case_2'
"test2"
end
mail(:to => emails_list, :subject => subject) do |format|
format.html {render template: @template, :layout => 'layouts/newdesign' }
end
end