Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/59.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails ActionMailer获取内容类型分隔符字符串_Ruby On Rails_Email_Attachment_Actionmailer - Fatal编程技术网

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

Ruby on rails Rails ActionMailer获取内容类型分隔符字符串,ruby-on-rails,email,attachment,actionmailer,Ruby On Rails,Email,Attachment,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

基于,我决定如果生成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

看看每个部分如何拥有一系列的部分


rel.parts.unshift rel.parts.pop

你想实现什么?我们需要一个例子来说明你想做什么/更好地阐述你的问题。对不起,我以为我已经链接到了我的另一个问题,但我想我忘了。实际上,“inline_attachment”gem创建的内联附件部分是在text/html部分之前生成的,因此一些电子邮件客户端无法正确显示电子邮件。内联附件部分应位于text/html部分之后。