Rails ActionMailer获取内容类型分隔符字符串

时间:2011-07-21 21:19:13

标签: ruby-on-rails email attachment actionmailer

关闭my other question,我决定如果生成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

1 个答案:

答案 0 :(得分:0)

看每个部件如何拥有一系列零件......

rel.parts.unshift rel.parts.pop