Rails ActionMailer 获取内容类型分隔符字符串
解决我的其他问题 ,我决定,如果生成了 html.body(包括部分分隔符),我可以从字符串创建一个数组,按部分分隔符分割并自己重新排序。如何从以下块中获取部分分隔符字符串?
copy.part :content_type => 'multipart/related' do |rel|
rel.part :content_type => 'text/html' do |html|
html.body = render(
:file => "main.text.html",
:body => {
:part_container => rel,
:user => @user,
:content => content,
:email_links => m.email_links,
:nav_image => m.nav_image
}
)
end
# I assume 'rel' is a 'part'...but how do I get "--93920293920-relative" for example from the html.body string?
html.body.split(???)
end
编辑:算了,任务完成了。一个简单的数组摆弄修复了它:
rel.parts.unshift rel.parts.pop
Working off of my other question, I've decided that if the html.body is generated (part separators included), I could just make an array from the string, split by the part separator and reorder it myself. How do I get the part separator string from the following block?
copy.part :content_type => 'multipart/related' do |rel|
rel.part :content_type => 'text/html' do |html|
html.body = render(
:file => "main.text.html",
:body => {
:part_container => rel,
:user => @user,
:content => content,
:email_links => m.email_links,
:nav_image => m.nav_image
}
)
end
# I assume 'rel' is a 'part'...but how do I get "--93920293920-relative" for example from the html.body string?
html.body.split(???)
end
EDIT: Forget it, mission accomplished. A simple array fiddling fixed it:
rel.parts.unshift rel.parts.pop
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看每个零件如何可以有一个零件数组...
rel.parts.unshift rel.parts.pop
Seeing as how each part can have an array of parts...
rel.parts.unshift rel.parts.pop